python 3 requests库2个问题

1.问题描述:
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='passport.cnblogs.com', port=443): Max retries exceeded with url: /user/signin (Caused by ProxyError('Cannot connect to proxy.', ConnectionResetError(10054, '远程主机强 迫关闭了一个现有的连接。', None, 10054, None)))
解决方案:
import os
os.environ['NO_PROXY'] = 'stackoverflow.com'

2问题描述:
C:\Python37\lib\site-packages\urllib3\connectionpool.py:1004: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning,
解决方案:
在导包时加入如下两行,取消警报
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

posted @ 2020-03-25 19:34  Golover  阅读(1316)  评论(0编辑  收藏  举报