How to disable SSL warnings in python requests

If you set verify=False when using requests

response = requests.request("POST",  
                      url,  
                      headers=headers,  
                      data=payload,  
                      verify=False)  

it will report the error Unverified HTTPS

InsecureRequestWarning: Unverified HTTPS request is being made to host 'xxx.xxx.xxx.xxx'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings  
  warnings.warn(  

If you want to disable this warning, just add the mysterious code before it

import urllib3  
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)  
  
response = requests.request("POST",  
                      url,  
                      headers=headers,  
                      data=payload,  
                      verify=False)  

Then it will run fine, but of course it’s best to properly configure SSL to avoid the error.