Python3 - Requests with Sock5 proxy
问题 Is there a way to use sock5 proxy to use TOR with requests? I know that requests only use http proxy... import requests r = requests.get('http://www.google.com',proxies= my_proxy) 回答1: You can use socks, socket modules import socks import socket from urllib import request socks.set_default_proxy(socks.SOCKS5, "localhost", 9050) socket.socket = socks.socksocket r = request.urlopen('http://icanhazip.com') print(r.read()) # check ips The socks package can be installed from multiple packages