简体   繁体   English

python 请求不适用于 vpn ProxyError('无法连接到代理。',

[英]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.

相关问题 'ProxyError('无法连接到代理。', NewConnectionError - 'ProxyError('Cannot connect to proxy.', NewConnectionError Python - Pip 安装 - 代理错误 - '无法连接到代理。',OSError' - Python - Pip Install - Proxy Error - 'Cannot connect to proxy.', OSError' Python 请求从 URL 下载文件,查询字符串抛出 ProxyError HTTPSConnectionPool,无法连接到代理,没有这样的文件或目录 - Python request to download file from URL with Query String throws ProxyError HTTPSConnectionPool, Cannot connect to proxy, no such file or directory Pip ProxyError 无法连接到 CentOS Linux 版本 7.9.2009 上的代理 - Pip ProxyError Cannot connect to proxy on CentOS Linux release 7.9.2009 未捕获Python请求ProxyError - Python Requests ProxyError not caught 如何在Python中连接VPN /代理? - How to VPN/Proxy connect in Python? Python请求无法连接到Squid代理 - Python Requests cannot connect to Squid Proxy 连接到Zap代理Docker映像,“ URL超过最大重试次数:由ProxyError引起('无法连接到代理 - Connecting to Zap Proxy Docker Image, "Max retries exceeded with url: Caused by ProxyError('Cannot connect to proxy 如何通过Python连接到VPN /代理服务器? - How to connect to a VPN/Proxy server via Python? Python请求返回“无法连接到代理&错误10061” - Python requests returns “cannot connect to proxy & error 10061”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM