Python crawler requests teaching (4): verify key word parameters

Digital certificates (commonly known as CA certificates, hereinafter referred to as CA certificates) provide electronic authentication for achieving secure communication between the two parties. In the Internet, company intranet or extranet, digital certificates are used to realize identity recognition and electronic information encryption. The digital certificate contains the identification information of the owner of the key pair (public key and private key), and the identity of the certificate holder is authenticated by verifying the authenticity of the identification information.

Python crawler, data analysis, website development and other case tutorial videos are free to watch online

https://space.bilibili.com/523606542 

Python learning exchange group: 1039645993

At present, major websites basically have their own CA certificates, but it is not ruled out that some websites do not purchase CA certificates in order to save website construction costs. And because the requests module will verify the CA certificate by default when sending network requests. If the current website does not have a CA certificate, the following error will be reported:

 

If the above error occurs, then we can use the verify keyword parameter to not verify the CA certificate of the website when requesting

response = requests.get( "url",verify=False)

If you add the keyword parameter verify=False, a warning will pop up when you use the requests module to send a request, warning you that the current request may be unsafe, as shown in the following figure:

 

 

This warning has no effect on the code logic behind. If you have obsessive-compulsive disorder, you can consider adding the following code to ignore the warning:

import urllib3
urllib3.disable_warnings() 

Guess you like

Origin blog.csdn.net/m0_48405781/article/details/115187321