我正在尝试使用高级代理ip连接到使用请求模块的网站,但它不适用于“https”网站
import requests
from requests.auth import HTTPProxyAuth
auth=HTTPProxyAuth('username','password')
proxies={
'http':'http://xxx.xxx.x.xxx:8080/',
'https':'http://xxx.xxx.x.xxx:8080/'
}
print(requests.get('https://www.google.com',proxies=proxies,auth=auth).status_code)
将引发以下错误:
raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.google.com',port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required')))
注意:我试过使用各种各样的猴子补丁,它们甚至在7年前就建议使用Digest Auth,但它们似乎都不起作用
编辑1:
我不是在用电脑http://username@密码:ip:用于使用代理的端口/格式,因为我的用户名包含“@”,这会导致分析错误
提前感谢:)
我想你可以用这个
您提到您的密码由特殊字符组成
“@”可以替换为“%40”
比如说,
"Pass@word'可以替换为'Pass%40word'
如果您在密码中输入更多特殊字符,以下数据可能会有所帮助
相关问题 更多 >
编程相关推荐