Python Disable InsecureRequestWarning error
Send HTTPS requests using Python 3 requests. When SSL authentication is turned off (verify = false):
import requests
response = requests.get(url='http://127.0.0.1:12345/test', verify=False)
Error Messages:
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
Solution:
#python3
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
#python2
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
PS: as shown below, disable_warnings() will disable all warning types.
def disable_warnings(category=exceptions.HTTPWarning):
"""
Helper for quickly disabling all urllib3 warnings.
"""
warnings.simplefilter("ignore", category)
Read More:
- How to Solve Python WARNING: Ignoring invalid distribution -ip (e:\python\python_dowmload\lib\site-packages)
- How to Solve Python ImportError: cannot import name UnrewindableBodyError
- Python: How to parses HTML, extracts data, and generates word documents
- How to Fix “HTTP error 403: forbidden” in Python 3. X
- How to Solve Python AttributeError: ‘dict’ object has no attribute ‘item’
- Python 2.7: How to Install PIP
- How to Solve Python Importerror: DLL load failed: unable to find the specified program using tensorflow
- Python: How to Auto Add Watermark to PDF
- Python: How to get the size of the picture (byte/kb/mb)
- Python: How to Obtaining Publick IP Quickly
- An introduction to sys modules in Python and how packages are imported and used
- [CHM] Python: How to Extract CHM Data
- How to Fix keyerror in Python dictionary lookup
- Python: How to Solve error While importing windpy
- Python: How to Costomize the Background of PS
- Python: How to Create an Automatic Recording Program
- Invalid python sd, Fatal Python error: init_fs_encoding: failed to get the Python cod [How to Solve]
- Python: How to Use os.path.join()
- How to Solve Python Libsm. So. 6 error
- Python: How to Use try exception to Display Abnormal Error Information