requests access https site certificate issues warning

background 

Api want to use way to access internal company azkaban platform, https site, curl statement azkaban use official api documentation, as follows:

 

curl -k -X POST --data "action=login&username=azkaban&password=azkaban" https://localhost:8443

 

Wherein allow curl -k represents a non-secure ssl connection and transfer data (non-trusted certificate)

Thus, the need to set the request in the request in python

 

operating

In fact, very simple addition of a cross reference (verify = False) requests in the request, as follows:

 

resp = requests.post(
            url=azkaban_url, headers=header, data=data, verify=False )

 

But added that there will be a warnning warning, which means prompt unsafe, after all this is to ignore SSL certificate security issues

Probably the error is as follows:

 

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html InsecureRequestWarning)

 

The official solution is given as follows:

 

Import urllib3 # turn off SSL authentication The warn
 urllib3. disable_warnings ()

 

reference

https://azkaban.readthedocs.io/en/latest/ajaxApi.html#authenticate

https://www.cnblogs.com/lxyit/p/9173842.html

https://blog.bbzhh.com/index.php/archives/111.html

Guess you like

Origin www.cnblogs.com/jwentest/p/11363807.html