What is the SSL certificate verification method of Python requests?
This article mainly explains the "Python requests SSL certificate verification method is what", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "Python requests SSL certificate verification method is what" it!
SSL certificate verification for requests 1. For HTTPS
SSL authentication is enabled by default, and failure to verify SSL certificates results in:
Requests.exceptions.SSLError: ("bad handshake: Error ([('SSL routines',' tls_process_server_certificate', 'certificate verify failed')],)",)
Solution:
# add verify=Falseres = requests.get (ur,verify=False) 2 to requests. After the above steps, a warning will appear
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)
Solution:
From requests.packages.urllib3.exceptions import InsecureRequestWarning# disable Security request warning requests.packages.urllib3.disable_warnings (InsecureRequestWarning) requests handles untrusted ssl certificates do not validate SSL certificate requests.get (url,verify=False)
The previous 12306 certificate was not authenticated
For https protocol
There will be an encryption authentication for the ssl certificate
Thank you for your reading, these are the contents of "what is Python requests's SSL certificate verification method?" after the study of this article, I believe you have a deeper understanding of what Python requests's SSL certificate verification method is, and the specific use also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!