request返回cookie
时间: 2023-09-27 22:10:56 浏览: 80
当使用requests库发送请求后,可以通过response对象的cookies属性来获取返回的cookie信息。例如,可以使用以下代码来获取cookie信息:
```python
import requests
response = requests.get('http://www.example.com')
cookies = response.cookies
print(cookies)
```
这样就可以打印出返回的cookie信息。
#### 引用[.reference_title]
- *1* *2* [Python—requests模块详解](https://blog.csdn.net/Asahi_aileen/article/details/109032015)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [requests的cookie使用](https://blog.csdn.net/qq_34577961/article/details/123468227)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文