requests模組獲取cookie

喜歡吃蔬菜~發表於2018-08-15

requests.utils.dict_from_cookiejar:把cookiejar物件轉化為字典

import requests

url = "http://www.baidu.com"
response = requests.get(url)
print(type(response.cookies))

cookies = requests.utils.dict_from_cookiejar(response.cookies)
print(cookies)

相關文章