securecookie.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:tellmeabout.coffee 作者: billyfung 项目源码 文件源码
def load_cookie(cls, request, key='session', secret_key=None):
        """Loads a :class:`SecureCookie` from a cookie in request.  If the
        cookie is not set, a new :class:`SecureCookie` instanced is
        returned.

        :param request: a request object that has a `cookies` attribute
                        which is a dict of all cookie values.
        :param key: the name of the cookie.
        :param secret_key: the secret key used to unquote the cookie.
                           Always provide the value even though it has
                           no default!
        """
        data = request.cookies.get(key)
        if not data:
            return cls(secret_key=secret_key)
        return cls.unserialize(data, secret_key)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号