2015年11月14日 星期六

[python] disable This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail.


InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.

 

使用 python requests 若是會出現 SSL fails 但是又想忽略的話
可以使用
requests.get('https://kennethreitz.com', verify=False)
還有
requests.packages.urllib3.disable_warnings()  


這樣就是可以 Disable  掉這些訊息

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)

2 則留言:

  1. HI buddy! Its hard to find someone like you who has insterest in Coding and Martial art.
    Hoping we can make progress in what we love

    回覆刪除
    回覆
    1. It's good to see you . Loooooooool time no seee.

      刪除