测试代码如下
import requestsip = '146.78.85.145'
port = 9527
username = '*********'
password = '*********'
proxies = {'http': f'socks5://{username}:{password}@{ip}:{port}','https': f'socks5://{username}:{password}@{ip}:{port}'
}
print(proxies)
body = requests.get("https://httpbin.org/ip", proxies=proxies).json()
print(body)
运行出现如下该错误:requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support.
解决方法,安装对应支持包
pip install requests[socks]