requests使用“proxy”代理访问接口

在requests中使用proxy代理访问

使用前先更新requests版本为支持socks的版本。
 
先pip安装对应库: 
>> pip install -U requests[socks]
 
脚本添加和使用代理:
 
import requests
....
proxy = {
}
....
# 使用代理发送请求
....
ret = requests.post(url, json=params, proxies=proxy).content
....
posted @ 2019-03-12 10:43  海布里Simple  阅读(3403)  评论(0编辑  收藏  举报