当前位置: 首页>>代码示例>>Python>>正文


Python SimpleCookie.iteritems方法代码示例

本文整理汇总了Python中Cookie.SimpleCookie.iteritems方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleCookie.iteritems方法的具体用法?Python SimpleCookie.iteritems怎么用?Python SimpleCookie.iteritems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cookie.SimpleCookie的用法示例。


在下文中一共展示了SimpleCookie.iteritems方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __read_cookies

# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import iteritems [as 别名]
 def __read_cookies(self):
     from Cookie import SimpleCookie
     cookies_raw = SimpleCookie(self.get_env('HTTP_COOKIE'))
     cookies     = {}
     for key, field in cookies_raw.iteritems():
         cookies[key] = field.value
     return Table(cookies, allow_duplicates = False, readonly = True)
开发者ID:bzhpwr,项目名称:Exports,代码行数:9,代码来源:CgiRequest.py

示例2: cookies

# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import iteritems [as 别名]
 def cookies(self):
     """Stored Cookies."""
     cookie = SimpleCookie()
     cookie.load(self.environ.get('HTTP_COOKIE', ''))
     result = {}
     for key, value in cookie.iteritems():
         result[key] = value.value.decode(self.charset, 'ignore')
     return result
开发者ID:lshmenor,项目名称:IMTAphy,代码行数:10,代码来源:wsgiutil.py

示例3: cookies

# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import iteritems [as 别名]
 def cookies(self):
     from Cookie import SimpleCookie
     cookie = SimpleCookie()
     cookie.load(self.environ.get('HTTP_COOKIE', ''))
     result = {}
     for key, value in cookie.iteritems():
         result[key] = value
     return result
开发者ID:demonlife,项目名称:batpod,代码行数:10,代码来源:batpod.py

示例4: dump_cookies

# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import iteritems [as 别名]
def dump_cookies(response = None):
    if not response:
        response = current_app.make_response('')
    cookie_headers = (header[1] for header in response.headers if header[0] == 'Set-Cookie')
    cookies = SimpleCookie()
    for header in cookie_headers:
        cookies.load(str(header))
    cookies_dump = []
    cookies_dump += dict(request.cookies),
    cookies_dump += dict((name, dict(value=cookie.coded_value, **cookie))\
                                        for name, cookie in cookies.iteritems()),

    response.data = render_template('dump_cookies.html', dump=dumps(cookies_dump))
    return response
开发者ID:pombredanne,项目名称:yatest,代码行数:16,代码来源:http.py

示例5: rewrite

# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import iteritems [as 别名]
    def rewrite(self, cookie_str, header='Set-Cookie'):
        results = []
        cookie = SimpleCookie()
        try:
            cookie.load(cookie_str)
        except CookieError:
            return results

        for name, morsel in cookie.iteritems():
            morsel = self.rewrite_cookie(name, morsel)
            if morsel:
                results.append((header, morsel.OutputString()))

        return results
开发者ID:akeprojecta,项目名称:pywb,代码行数:16,代码来源:cookie_rewriter.py

示例6: parse_cookie

# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import iteritems [as 别名]
def parse_cookie(environ):
    """Parse the cookie from request.

    :return A dict(key: cookie name, value: the cookie value, not the instance of Morsel)
            The cookies should be like this:
            {'session_id': '1', 'test': 'xxx'}

    """
    raw_cookie = SimpleCookie(environ.get('HTTP_COOKIE', ''))
    cookie = {}
    for key, value in raw_cookie.iteritems():
        # cookie[key] = value.OutputString()[len(key)+1:]
        cookie_str = value.OutputString()
        k, v = parse_dict_string(cookie_str, split_sign='=', use_tuple=True)
        cookie[k] = v
    return cookie
开发者ID:AliceLanniste,项目名称:Puck,代码行数:18,代码来源:cookies.py

示例7: generate_cookies

# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import iteritems [as 别名]
def generate_cookies():
    cookies = SimpleCookie()

    cookies['view']        =        view_to_str(options.view)
    cookies['state']       =       state_to_str(remote_state.state)
    cookies['mode']        =        mode_to_str(remote_state.mode)
    cookies['temperature'] = temperature_to_str(remote_state.temperature)
    cookies['fan_speed']   =   fan_speed_to_str(remote_state.fan_speed)
    cookies['full_effect'] = full_effect_to_str(remote_state.full_effect)
    cookies['ion']         =         ion_to_str(remote_state.ion)
    cookies['swing']       =       swing_to_str(remote_state.swing)

    for (k, v) in cookies.iteritems():
        v['path'] = '/'

    return cookies
开发者ID:skarlsso,项目名称:IRRemoteIVT.web,代码行数:18,代码来源:wsgi.py

示例8: rewrite

# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import iteritems [as 别名]
    def rewrite(self, cookie_str, header='Set-Cookie'):
        results = []
        cookie = SimpleCookie()
        try:
            cookie.load(cookie_str)
        except CookieError:
            return results

        for name, morsel in cookie.iteritems():
            morsel = self.rewrite_cookie(name, morsel)

            if morsel:
                path = morsel.get('path')
                if path:
                    inx = path.find(self.url_rewriter.rel_prefix)
                    if inx > 0:
                        morsel['path'] = path[inx:]

                results.append((header, morsel.OutputString()))

        return results
开发者ID:Orbiter,项目名称:pywb,代码行数:23,代码来源:cookie_rewriter.py

示例9: _parse_cookies

# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import iteritems [as 别名]
def _parse_cookies(request):
  cookie = Cookie(request["headers"].get("cookie"))
  parsed = {}
  for k, v in cookie.iteritems():
    parsed[k] = v.value
  return parsed
开发者ID:ianthehenry,项目名称:pump,代码行数:8,代码来源:cookies.py

示例10: _parse_cookie

# 需要导入模块: from Cookie import SimpleCookie [as 别名]
# 或者: from Cookie.SimpleCookie import iteritems [as 别名]
 def _parse_cookie(self):
     try:
         cookie = SimpleCookie(self._env.get('HTTP_COOKIE'))
     except CookieError:
         cookie = {}
     self.cookie = dict((k, v.value) for k, v in cookie.iteritems())
开发者ID:rivan,项目名称:w3fu,代码行数:8,代码来源:http.py


注:本文中的Cookie.SimpleCookie.iteritems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。