[英]python requests not work with vpn ProxyError('Cannot connect to proxy.',
I use requests with vpn and it show error我将请求与 vpn 一起使用,但它显示错误
(Caused by ProxyError('Cannot connect to proxy.', OSError(0, 'Error')))
this is code这是代码
import requests
con = requests.get(url)
I can visit url in browser with vpn.我可以用vpn在浏览器中访问url。 I hav to use vpn to requests.我必须使用 vpn 来请求。 use Python 3.7.9使用 Python 3.7.9
using pyPAC works for me... https://pypac.readthedocs.io/en/latest/使用 pyPAC 对我有用...... https://pypac.readthedocs.io/en/latest/
from pypac import PACSession
from requests.auth import HTTPProxyAuth
session = PACSession()
r = session.get('http://google.com')
you may need to update your python version or use an older version of pyPAC that matches your python version.您可能需要更新您的 python 版本或使用与您的 python 版本匹配的旧版本的 pyPAC。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.