3
votes

how to send certificate authentication in python post request, for example I used next but in get request: requests.get(url, params = params, timeout=60,cert=certs) where certs is path to certificate, it's worked fine. requests.post(url_post,data=params,cert = certs, timeout=60) not working, error - SSL authentication error

1
Can you show some code? - oshaiken
requests.post(url_post,data=params,cert = certs, timeout=60) - MR.A

1 Answers

1
votes

To send certificate, you need the certificate which contains public key like server.crt. If you have this crt file then you can send it as

r=requests.get('https://server.com', verify='server.crt' )

or if you don't have that file then you can get it using get_ssl_certificate method

ert=ssl.get_server_certificate(('server.com',443),ssl_version=3)

then you can write it into a file and send it.