本文整理汇总了Python中swift.common.wsgi.WSGIContext类的典型用法代码示例。如果您正苦于以下问题:Python WSGIContext类的具体用法?Python WSGIContext怎么用?Python WSGIContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WSGIContext类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, env, app, account_name, token, **kwargs):
WSGIContext.__init__(self, app)
conf = kwargs.get('conf', {})
self.logger = kwargs.get('logger', {})
env['HTTP_X_AUTH_TOKEN'] = token[0]
env['HTTP_X_AUTH_TOKEN_ALT'] = token[1]
env['PATH_INFO'] = '/v1/%s' % account_name
开发者ID:kostecky,项目名称:swift3,代码行数:7,代码来源:middleware.py
示例2: __init__
def __init__(self, env, app, account_name, token, container_name,
**kwargs):
WSGIContext.__init__(self, app)
self.container_name = unquote(container_name)
self.account_name = unquote(account_name)
env['HTTP_X_AUTH_TOKEN'] = token
env['PATH_INFO'] = '/v1/%s/%s' % (account_name, container_name)
开发者ID:TMG-nl,项目名称:swift3,代码行数:7,代码来源:middleware.py
示例3: __init__
def __init__(self, env, app, account_name, token, container_name,
**kwargs):
WSGIContext.__init__(self, app)
self.container_name = unquote(container_name)
self.account_name = unquote(account_name)
env['HTTP_X_AUTH_TOKEN'] = token
env['PATH_INFO'] = '/v1/%s/%s' % (account_name, container_name)
conf = kwargs.get('conf', {})
self.location = conf.get('location', 'US')
开发者ID:CiscoSystems,项目名称:swift-plugin-s3,代码行数:9,代码来源:middleware.py
示例4: __init__
def __init__(self, env, app, account_name, token, container_name, **kwargs):
self.MAX_BUCKET_LISTING = 1000
WSGIContext.__init__(self, app)
self.container_name = unquote(container_name)
self.account_name = unquote(account_name)
env["HTTP_X_AUTH_TOKEN"] = token
env["PATH_INFO"] = "/v1/AUTH_%s/%s" % (account_name, container_name)
conf = kwargs.get("conf", {})
self.location = conf.get("location", "US")
开发者ID:pyKun,项目名称:swift3,代码行数:9,代码来源:bucket.py
示例5: __init__
def __init__(self, staticweb, version, account, container, obj):
WSGIContext.__init__(self, staticweb.app)
self.version = version
self.account = account
self.container = container
self.obj = obj
self.app = staticweb.app
self.agent = "%(orig)s StaticWeb"
# Results from the last call to self._get_container_info.
self._index = self._error = self._listings = self._listings_css = self._dir_type = None
开发者ID:zhouyuan,项目名称:swift,代码行数:10,代码来源:staticweb.py
示例6: __init__
def __init__(self, staticweb, version, account, container, obj):
WSGIContext.__init__(self, staticweb.app)
self.version = version
self.account = account
self.container = container
self.obj = obj
self.app = staticweb.app
self.cache_timeout = staticweb.cache_timeout
self.logger = staticweb.logger
self.access_logger = staticweb.access_logger
self.log_headers = staticweb.log_headers
self.agent = '%(orig)s StaticWeb'
# Results from the last call to self._get_container_info.
self._index = self._error = self._listings = self._listings_css = None
开发者ID:CiscoSystems,项目名称:swift,代码行数:14,代码来源:staticweb.py
示例7: __init__
def __init__(self, rewrite, conf):
WSGIContext.__init__(self, rewrite.app)
self.app = rewrite.app
self.logger = rewrite.logger
self.account = conf['account'].strip()
self.thumbhost = conf['thumbhost'].strip()
self.thumborhost = conf['thumborhost'].strip() if 'thumborhost' in conf else None
self.thumbor_wiki_list = [item.strip() for item in conf['thumbor_wiki_list'].split(',')] if 'thumbor_wiki_list' in conf else None
self.user_agent = conf['user_agent'].strip()
self.bind_port = conf['bind_port'].strip()
self.shard_container_list = [item.strip() for item in conf['shard_container_list'].split(',')]
# this parameter controls whether URLs sent to the thumbhost are sent as is (eg. upload/proj/lang/) or with the site/lang
# converted and only the path sent back (eg en.wikipedia/thumb).
self.backend_url_format = conf['backend_url_format'].strip() # asis, sitelang
开发者ID:hpdang,项目名称:mediawiki-vagrant,代码行数:15,代码来源:rewrite.py
示例8: __init__
def __init__(self, swascii, version, account, container, obj, conf):
WSGIContext.__init__(self, swascii.app)
self.app = swascii.app
self.version = version
self.account = account
self.container = container
self.obj = obj
self.greyscale = [" ",
" ",
".,-",
"_ivc=!/|\~=",
"gjez2](YL)t[+T7Vf",
"mdK4~GbNDXY5P*Q",
"W8KMA",
"#%$"
]
self.zonebounds = [36, 72, 108, 144, 180, 216, 252]
开发者ID:ahale,项目名称:swascii,代码行数:17,代码来源:middleware.py
示例9: __init__
def __init__(self, rewrite, conf):
def striplist(l):
return([x.strip() for x in l])
WSGIContext.__init__(self, rewrite.app)
self.app = rewrite.app
self.logger = rewrite.logger
self.account = conf['account'].strip()
self.thumbhost = conf['thumbhost'].strip()
self.user_agent = conf['user_agent'].strip()
self.bind_port = conf['bind_port'].strip()
self.shard_containers = conf['shard_containers'].strip() #all, some, none
if (self.shard_containers == 'some'):
# if we're supposed to shard some containers, get a cleaned list of the containers to shard
self.shard_container_list = striplist(conf['shard_container_list'].split(','))
# this parameter controls whether URLs sent to the thumbhost are sent as is (eg. upload/proj/lang/) or with the site/lang
# converted and only the path sent back (eg en.wikipedia/thumb).
self.backend_url_format = conf['backend_url_format'].strip() #'asis', 'sitelang'
开发者ID:huadaonan,项目名称:dev-puppet,代码行数:19,代码来源:rewrite.py
示例10: __init__
def __init__(self, slo, slo_etag):
WSGIContext.__init__(self, slo.app)
self.slo_etag = '"' + slo_etag.hexdigest() + '"'
开发者ID:674009287,项目名称:swift,代码行数:3,代码来源:slo.py
示例11: __init__
def __init__(self, wsgi_app, logger):
WSGIContext.__init__(self, wsgi_app)
self.logger = logger
开发者ID:ISCAS-VDI,项目名称:swift-base,代码行数:3,代码来源:versioned_writes.py
示例12: __init__
def __init__(self, slowdown, data_to_read, sleep_time, req):
WSGIContext.__init__(self, slowdown.app)
self.data_to_read = data_to_read
self.sleep_time = sleep_time
self.req = req
开发者ID:dpgoetz,项目名称:slowdown,代码行数:5,代码来源:slowdown.py
示例13: __call__
def __call__(self, env, start_response):
# a lot of this is cribbed from listing_formats / swob.Request
if env['REQUEST_METHOD'] != 'GET':
# Nothing to translate
return self.app(env, start_response)
try:
v, a, c = split_path(env.get('SCRIPT_NAME', '') +
env['PATH_INFO'], 3, 3)
if not valid_api_version(v):
raise ValueError
except ValueError:
# not a container request; pass through
return self.app(env, start_response)
ctx = WSGIContext(self.app)
resp_iter = ctx._app_call(env)
content_type = content_length = cl_index = None
for index, (header, value) in enumerate(ctx._response_headers):
header = header.lower()
if header == 'content-type':
content_type = value.split(';', 1)[0].strip()
if content_length:
break
elif header == 'content-length':
cl_index = index
try:
content_length = int(value)
except ValueError:
pass # ignore -- we'll bail later
if content_type:
break
if content_type != 'application/json' or content_length is None or \
content_length > MAX_CONTAINER_LISTING_CONTENT_LENGTH:
start_response(ctx._response_status, ctx._response_headers,
ctx._response_exc_info)
return resp_iter
# We've done our sanity checks, slurp the response into memory
with closing_if_possible(resp_iter):
body = b''.join(resp_iter)
try:
listing = json.loads(body)
for item in listing:
if 'subdir' in item:
continue
value, params = parse_header(item['hash'])
if 's3_etag' in params:
item['s3_etag'] = '"%s"' % params.pop('s3_etag')
item['hash'] = value + ''.join(
'; %s=%s' % kv for kv in params.items())
except (TypeError, KeyError, ValueError):
# If anything goes wrong above, drop back to original response
start_response(ctx._response_status, ctx._response_headers,
ctx._response_exc_info)
return [body]
body = json.dumps(listing).encode('ascii')
ctx._response_headers[cl_index] = (
ctx._response_headers[cl_index][0],
str(len(body)),
)
start_response(ctx._response_status, ctx._response_headers,
ctx._response_exc_info)
return [body]
开发者ID:mahak,项目名称:swift,代码行数:68,代码来源:s3api.py
注:本文中的swift.common.wsgi.WSGIContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论