文章目录
一、Python requests模块
requests
是一个用 Python 语言编写的,用于发送 HTTP 请求的库。它使得发送 HTTP 请求变得简单,无需手动添加查询字符串到你的 URL 中,或者手动处理表单的编码。requests
会自动为你处理这些事情。
以下是一些使用 requests
发送 HTTP 请求的基本示例:
1. 安装 requests
首先,你需要安装 requests
库。如果你还没有安装,可以使用 pip
来安装:
pip install requests
2. 发送 GET 请求
import requests
response = requests