kainhuck

方法1

  1. 安装PySocks
sudo pip3 install PySocks -i https://pypi.tuna.tsinghua.edu.cn/simple
  1. 使用代理
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)
...

方法2

import requests

proxies = {
    \'http\': \'socks5://127.0.0.1:20808\',
    \'https\': \'socks5://127.0.0.1:20808\'
}

r = requests.get(url, proxies=proxies)

分类:

技术点:

相关文章:

  • 2021-09-28
  • 2021-09-28
  • 2019-10-05
  • 2021-09-07
  • 2021-12-28
  • 2021-09-28
猜你喜欢
  • 2021-09-28
  • 2021-09-28
  • 2021-06-20
  • 2021-11-02
  • 2021-10-25
  • 2021-11-02
  • 2021-09-28
相关资源
相似解决方案