python 爬虫requests库使用socks5代理
时间:2020-03-05 18:48:26
收藏:0
阅读:582
1. 安装PySocks
sudo pip3 install PySocks -i https://pypi.tuna.tsinghua.edu.cn/simple
2. 使用代理
import socket
import socks
import requests
socks.set_default_proxy(socks.SOCKS5, "127.0.0.1", 1080)
socket.socket = socks.socksocket
r = requests.get(url)
...
原文:https://www.cnblogs.com/kainhuck/p/12421700.html
评论(0)