import requests
proxy = {
"http": "socks5://xx.xx.xx.xx:8080",
'https': 'socks5h://xx.xx.xx.xx:8080'
}
#proxiy = {
# 'http': 'socks5://user:pass@host:port',
# 'https': 'socks5h://user:pass@host:port'
# }
url = 'https://www.google.com'
r = requests.get(url, proxies=proxy, verify=False)
print(r.content)
PS:需要安装PySocks库,requests需要升至最新版
pip install PySocks
pip install --upgrade requests