使用系统代理在Pycharm中无法发起请求

总结:

应该避免在使用抓包工具或代理的同时发起请求, 如果你就是有这种需求, 那就更改ide代理配置

错误结果: requests.exceptions.SSLError: HTTPSConnectionPool(host='www.google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)')))

原始错误: 

Traceback (most recent call last):
  File "C:/Users/Administrator/Desktop/public-pro/hltv/get_cookie.py", line 3, in 
    r = requests.get(u)
  File "D:\anaconda\envs\hltv\lib\site-packages\requests\api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "D:\anaconda\envs\hltv\lib\site-packages\requests\api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "D:\anaconda\envs\hltv\lib\site-packages\requests\sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "D:\anaconda\envs\hltv\lib\site-packages\requests\sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "D:\anaconda\envs\hltv\lib\site-packages\requests\adapters.py", line 563, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)')))

解决方法:

更新urllib版本为 1.25.11: pip install urllib3==1.25.11

你可能感兴趣的:(Pycharm,pycharm,ide,python)