摘要: http 和 https区别 -http:超文本传输协议 -https:安全的超文本传输协议 -https=http+ssl/tls -防止:篡改,截取 -必须有证书:才能通信 使用方式 import requests header = { 'User-Agent': 'Mozilla/5.0 (W 阅读全文
posted @ 2024-02-19 16:33 wellplayed 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 获取代理池ip import requests res = requests.get('http://demo.spiderpy.cn/get/?type=https') print(res.json()) print(res.json()['proxy']) # 112.30.155.83:127 阅读全文
posted @ 2024-02-19 16:31 wellplayed 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 超时设置 import requests respone=requests.get('https://www.baidu.com',timeout=0.0001) 异常处理 import requests from requests.exceptions import * #可以查看requests 阅读全文
posted @ 2024-02-19 16:28 wellplayed 阅读(8) 评论(0) 推荐(0) 编辑
摘要: requests发送请求后会返回响应对象 import requests respone = requests.get('xxx') respone属性 响应体--字符串形式 print(respone.text) 响应体--bytes格式 print(respone.content) 响应状态码 阅读全文
posted @ 2024-02-19 16:17 wellplayed 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 发送登录请求 import requests data = { 'username': '用户名', 'password': '密码', 'captcha': '3333', 'remember': '1', 'ref': ' http://www.aa7a.cn/', # 登录成功,重定向到这个地 阅读全文
posted @ 2024-02-19 16:03 wellplayed 阅读(75) 评论(0) 推荐(0) 编辑
摘要: 首先需要导入模块 import requests 携带get请求方式 params = { 'xxx': 'yyy', } res = requests.get('xxx',params=params) print(res.text) # 打印响应体内容 携带请求头 headers = { 'Use 阅读全文
posted @ 2024-02-19 15:49 wellplayed 阅读(9) 评论(0) 推荐(0) 编辑