request.py 文件源码

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

项目:zhihuapi-py 作者: syaning 项目源码 文件源码
def setCookie(self, cookie):
        c = cookies.SimpleCookie()
        c.load(cookie)
        if 'z_c0' not in c:
            raise Exception('Invalid cookie: '
                            'no authorization (z_c0) in cookie')
        if '_xsrf' not in c:
            raise Exception('Invalid cookie: no _xsrf in cookie')
        self.headers['Cookie'] = cookie.strip()
        self.headers['Authorization'] = 'Bearer %s' % c['z_c0'].value
        self._xsrf = c['_xsrf'].value
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号