本文整理汇总了Python中swift.common.swob.Response.headers["accept-ranges"]方法的典型用法代码示例。如果您正苦于以下问题:Python Response.headers["accept-ranges"]方法的具体用法?Python Response.headers["accept-ranges"]怎么用?Python Response.headers["accept-ranges"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类swift.common.swob.Response
的用法示例。
在下文中一共展示了Response.headers["accept-ranges"]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: max
# 需要导入模块: from swift.common.swob import Response [as 别名]
# 或者: from swift.common.swob.Response import headers["accept-ranges"] [as 别名]
last_modified = max(o["last_modified"] for o in listing)
last_modified = datetime(*map(int, re.split("[^\d]", last_modified)[:-1]))
etag = md5("".join(o["hash"] for o in listing)).hexdigest()
except KeyError:
return HTTPServerError("Invalid Manifest File", request=req)
else:
content_length = 0
last_modified = resp.last_modified
etag = md5().hexdigest()
resp = Response(headers=resp.headers, request=req, conditional_response=True)
resp.app_iter = SegmentedIterable(self, lcontainer, listing, resp, is_slo=(large_object == "SLO"))
resp.content_length = content_length
resp.last_modified = last_modified
resp.etag = etag
resp.headers["accept-ranges"] = "bytes"
# In case of a manifest file of nonzero length, the
# backend may have sent back a Content-Range header for
# the manifest. It's wrong for the client, though.
resp.content_range = None
return resp
@public
@cors_validation
@delay_denial
def GET(self, req):
"""Handler for HTTP GET requests."""
return self.GETorHEAD(req)
@public