本文整理汇总了Python中Cookie.SimpleCookie.itervalues方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleCookie.itervalues方法的具体用法?Python SimpleCookie.itervalues怎么用?Python SimpleCookie.itervalues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cookie.SimpleCookie
的用法示例。
在下文中一共展示了SimpleCookie.itervalues方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: COOKIES
# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import itervalues [as 别名]
def COOKIES(self):
if 'brick.cookies' not in self.environ:
raw_dict = SimpleCookie(self.environ.get('HTTP_COOKIE',''))
self.environ['brick.cookies'] = {}
for cookie in raw_dict.itervalues():
self.environ['brick.cookies'][cookie.key] = cookie.value
return self.environ['brick.cookies']
示例2: COOKIES
# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import itervalues [as 别名]
def COOKIES(self):
""" Returns a dict with COOKIES. """
if self._COOKIES is None:
raw_dict = SimpleCookie(self._environ.get('HTTP_COOKIE',''))
self._COOKIES = {}
for cookie in raw_dict.itervalues():
self._COOKIES[cookie.key] = cookie.value
return self._COOKIES
示例3: __process_cookies
# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import itervalues [as 别名]
def __process_cookies(self):
simple_cookie = SimpleCookie(self.headers.get("Cookie",{}))
cookies = dict()
for cookie in simple_cookie.itervalues():
cookies[cookie.key] = cookie.value
return cookies
示例4: COOKIES
# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import itervalues [as 别名]
def COOKIES(self):
""" Dictionary with parsed cookie data. """
if self._COOKIES is None:
raw_dict = SimpleCookie(self.environ.get('HTTP_COOKIE',''))
self._COOKIES = {}
for cookie in raw_dict.itervalues():
self._COOKIES[cookie.key] = cookie.value
return self._COOKIES
示例5: COOKIES
# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import itervalues [as 别名]
def COOKIES(self):
""" Cookies parsed into a dictionary. Secure cookies are NOT decoded
automatically. See :meth:`get_cookie` for details.
"""
raw_dict = SimpleCookie(self.headers.get('Cookie',''))
cookies = {}
for cookie in raw_dict.itervalues():
cookies[cookie.key] = cookie.value
return cookies
示例6: _get_cookies
# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import itervalues [as 别名]
def _get_cookies(self, response):
c = SimpleCookie()
for h, v in response.getheaders():
if h == 'set-cookie':
c.load(v)
for cookie in c.itervalues():
domain = cookie['domain'].rstrip(',').lstrip('.') or response.host
self.cookies[domain][cookie.key] = cookie
示例7: set_cookie
# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import itervalues [as 别名]
def set_cookie(self, name, value=None, domain='_all'):
if isinstance(name, Cookie):
name, value = name.name, name.value
domain = name.domain or domain
c = SimpleCookie()
c[name] = value
for cookie in c.itervalues():
self.cookies[domain.rstrip(',').lstrip('.')][cookie.key] = cookie
示例8: set_state
# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import itervalues [as 别名]
def set_state(self, state):
self.cookies.clear()
for domain, values in state.iteritems():
c = SimpleCookie()
for v in values:
c.load(v)
for cookie in c.itervalues():
self.cookies[domain][cookie.key] = cookie
示例9: HTTPPreamble
# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import itervalues [as 别名]
class HTTPPreamble(object):
def __init__(self, status_code=httplib.OK, reason=None, version='HTTP/1.1', headers=None, cookies=None):
self.status_code = status_code
self.reason = reason
self.version = version
self.headers = headers or {}
self.cookies = SimpleCookie()
for key, value in (cookies or {}).iteritems():
if isinstance(value, dict):
self.cookies[key] = value['value']
for name, morsel_attr in value:
self.cookies[key][name] = morsel_attr
else:
self.cookies[key] = value
def __str__(self):
lines = [utf8(self.version + b' ' + str(self.status_code) + b' ' + (self.reason or httplib.responses[self.status_code]))]
for name, values in self.headers.iteritems():
lines.extend([utf8(name) + b': ' + utf8(value) for value in (values if isinstance(values, list) else [values])])
lines.extend([str(cookie) for cookie in self.cookies.itervalues()])
return b'\r\n'.join(lines) + b'\r\n\r\n'
示例10: kcookies
# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import itervalues [as 别名]
def kcookies(self):
d=SimpleCookie(self.e.get('HTTP_COOKIE',''));c={}
for i in d.itervalues():c[i.key]=i.value
return c