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)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM