- 介绍
requests是一个很实用的Python HTTP客户端库,编写爬虫和测试服务器响应数据时经常会用到,Requests是Python语言的第三方的库,专门用于发送HTTP请求
- 前提
pip install requests
- get请求
import requests
class RequestClass01():
def requestMethod(self):
r = requests.get(“http://www.baidu.com”)
print®
rc = RequestClass01()
rc.requestMethod()
1
2
3
4
5
6
7
8
9
1)新建requestsDemo目录
2)在requestsDemo目录下新建requests01.py并写入代码
3)运行看效果
- get传参
p