python requests方法
时间: 2023-08-26 12:17:28 浏览: 92
Python中的requests库是一个常用的HTTP请求库,可以用来发送各种类型的HTTP请求。下面是使用requests库发送GET请求的示例代码:
```python
import requests
response = requests.get('http://httpbin.org/get')
print(response.status_code)
print(response.text)
```
这段代码使用requests库发送了一个GET请求到'http://httpbin.org/get',并打印了响应的状态码和响应内容。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Python中requests库使用方法详解](https://blog.csdn.net/qq_53381910/article/details/128857205)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [python requests详解](https://blog.csdn.net/godnightshao/article/details/129764556)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文