确认你的socks端口:
然后程序可以这么写:
import requests
import socks
import socket
# 创建 SOCKS5 代理连接
socks.set_default_proxy(socks.SOCKS5, "127.0.0.1", 10808)
socket.socket = socks.socksocket
# 发送请求
response = requests.get("https://www.flickr.com/search/?text=%E5%8F%AF%E7%88%B1%E7%9A%84", proxies={"https": "socks5://127.0.0.1:10808"})
print(response.text)