1 Star 0 Fork 0

Solitary pursuit of defeat/code_repository

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
cookie.py 1006 Bytes
一键复制 编辑 原始数据 按行查看 历史
yuanliangliang01 提交于 2023-05-24 10:50 . 变更
import requests
from requests.cookies import RequestsCookieJar
headers = {
'Host': 'accounts.douban.com',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
'Accept-Encoding': 'gzip, deflate, br',
'Connection': 'keep-alive'
}
request_url = "https://accounts.douban.com/passport/login"
res = requests.get(request_url, headers=headers)
status_code = res.status_code
res_header = res.headers
res_cookies = res.cookies
cookie1111 = res.cookies.get_dict() # 格式化 字典形式输出
cookie2222 = requests.utils.dict_from_cookiejar(res_cookies) # 格式化 字典形式输出
for cookie in res_cookies:
print(cookie.name+"\t"+cookie.value)
print("响应cookies:", res_cookies)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/yuanliangliang_repotory/cede_repotory.git
git@gitee.com:yuanliangliang_repotory/cede_repotory.git
yuanliangliang_repotory
cede_repotory
code_repository
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385