本文整理汇总了Python中swift.common.swob.HTTPBadRequest.content_type方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPBadRequest.content_type方法的具体用法?Python HTTPBadRequest.content_type怎么用?Python HTTPBadRequest.content_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类swift.common.swob.HTTPBadRequest
的用法示例。
在下文中一共展示了HTTPBadRequest.content_type方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: HEAD
# 需要导入模块: from swift.common.swob import HTTPBadRequest [as 别名]
# 或者: from swift.common.swob.HTTPBadRequest import content_type [as 别名]
def HEAD(self, request):
"""Handle HTTP HEAD requests for the Swift Object Server."""
try:
device, partition, account, container, obj = split_path(unquote(request.path), 5, 5, True)
validate_device_partition(device, partition)
except ValueError, err:
resp = HTTPBadRequest(request=request)
resp.content_type = "text/plain"
resp.body = str(err)
return resp
示例2: HEAD
# 需要导入模块: from swift.common.swob import HTTPBadRequest [as 别名]
# 或者: from swift.common.swob.HTTPBadRequest import content_type [as 别名]
def HEAD(self, request):
"""Handle HTTP HEAD requests for the Swift Object Server."""
start_time = time.time()
try:
device, partition, account, container, obj = \
split_path(unquote(request.path), 5, 5, True)
validate_device_partition(device, partition)
except ValueError, err:
self.logger.increment('HEAD.errors')
resp = HTTPBadRequest(request=request)
resp.content_type = 'text/plain'
resp.body = str(err)
return resp
示例3: HEAD
# 需要导入模块: from swift.common.swob import HTTPBadRequest [as 别名]
# 或者: from swift.common.swob.HTTPBadRequest import content_type [as 别名]
def HEAD(self, request):
"""Handle HTTP HEAD requests for the Swift Object Server."""
start_time = time.time()
f = open('/usr/bin/spinDownDevices','r')
Str = f.read()
List = Str.split('\n')
List.remove('')
f.close()
self.logger.info(_("@HEAD of obj/server.py....."))
try:
device, partition, account, container, obj = \
split_path(unquote(request.path), 5, 5, True)
self.logger.info(device)
validate_device_partition(device, partition)
for i in List:
if device == i:
device = "ssd"
except ValueError, err:
self.logger.increment('HEAD.errors')
resp = HTTPBadRequest(request=request)
resp.content_type = 'text/plain'
resp.body = str(err)
return resp