最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網 會員登陸 & 注冊

python出現Cannot connect to proxy錯誤 - 四十九C-137

2023-03-04 11:54 作者:四十九C-137  | 我要投稿

原文地址:https://joessem.com/archives/python-connot-connect-to-proxy.html

在做 requests.get () 請求時出現 Cannot connect to proxy 的錯誤。

錯誤信息為:

Traceback (most recent call last): ?File "C:\Python38\lib\site-packages\requests\adapters.py", line 489, in send ? ?resp = conn.urlopen( ?File "C:\Python38\lib\site-packages\urllib3\connectionpool.py", line 785, in urlopen ? ?retries = retries.increment( ?File "C:\Python38\lib\site-packages\urllib3\util\retry.py", line 592, in increment ? ?raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='cn.bing.com', port=443): Max retries exceeded with url: /HPImageArchive.aspx?format=js&idx=0&n=1 (Caused by ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))) During handling of the above exception, another exception occurred: Traceback (most recent call last): ?File "f:/Project/api/main.py", line 45, in <module> ? ?get_bing_daily_img() ?File "f:/Project/api/main.py", line 39, in get_bing_daily_img ? ?api_rets = requests.get(api_url, verify=False) ?File "C:\Python38\lib\site-packages\requests\api.py", line 73, in get ? ?return request("get", url, params=params, **kwargs) ?File "C:\Python38\lib\site-packages\requests\api.py", line 59, in request ? ?return session.request(method=method, url=url, **kwargs) ?File "C:\Python38\lib\site-packages\requests\sessions.py", line 587, in request ? ?resp = self.send(prep, **send_kwargs) ?File "C:\Python38\lib\site-packages\requests\sessions.py", line 701, in send ?File "C:\Python38\lib\site-packages\requests\adapters.py", line 559, in send ? ?raise ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPSConnectionPool(host='cn.bing.com', port=443): Max retries exceeded with url:

解決方案:

在進行 requests.get (url) 方法調用前,請設置目標 url 的代理過濾, 例如:

os.environ['NO_PROXY'] = "cn.bing.com"?

api_rets = requests.get(api_url, verify=False)

? ? ? ? ? ? ? ? ? ?

本文使用 文章同步助手 同步


python出現Cannot connect to proxy錯誤 - 四十九C-137的評論 (共 條)

分享到微博請遵守國家法律
两当县| 青州市| 韶关市| 外汇| 高淳县| 霍州市| 彰化市| 乌拉特后旗| 布拖县| 红安县| 陵水| 乐陵市| 大理市| 天柱县| 资阳市| 南昌市| 通山县| 乡城县| 巴彦淖尔市| 盱眙县| 南平市| 安溪县| 冷水江市| 万山特区| 汝阳县| 时尚| 云安县| 泸溪县| 五大连池市| 新泰市| 博罗县| 怀仁县| 揭西县| 芜湖市| 伊通| 荣成市| 兴文县| 黔江区| 县级市| 商河县| 香港 |