html tool

2023年4月18日星期二

转:python3 InsecureRequestWarning: Unverified HTTPS request is being made to host 'XXXX'

 参考:https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings

urllib3 will issue several different warnings based on the level of certificate verification support. These warnings indicate particular situations and can be resolved in different ways.

  • InsecureRequestWarning

    This happens when a request is made to an HTTPS URL without certificate verification enabled. Follow the certificate verification guide to resolve this warning.

  • InsecurePlatformWarning

    This happens on Python 2 platforms that have an outdated ssl module. These older ssl modules can cause some insecure requests to succeed where they should fail and secure requests to fail where they should succeed. Follow the pyOpenSSL guide to resolve this warning.

  • SNIMissingWarning

    This happens on Python 2 versions older than 2.7.9. These older versions lack SNI support. This can cause servers to present a certificate that the client thinks is invalid. Follow the pyOpenSSL guide to resolve this warning.

Making unverified HTTPS requests is strongly discouraged, however, if you understand the risks and wish to disable these warnings, you can use disable_warnings():

>>> import urllib3
>>> urllib3.disable_warnings()

没有评论:

发表评论