Tuesday, 26 July 2022

python requests library advance usage - SSL certifciates

If you are sending request your server is client.


Ignore server cerficate validation(Python SSL certificate verify error):

https://stackoverflow.com/questions/51390968/python-ssl-certificate-verify-error

Soln 1) ignore python requests buildin server certificate validation:

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

soln 2)
add server certificate to python : 
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org jupyterlab




Server side requires client to send client certificate along with request:

Python Requests SSL: TLSV13_ALERT_CERTIFICATE_REQUIRED 

https://stackoverflow.com/questions/65131515/python-requests-ssl-tlsv13-alert-certificate-required-tlsv13-alert-certificat



https://requests.readthedocs.io/en/latest/user/advanced/#client-side-certificates

requests.get('https://kennethreitz.org', cert=('/path/client.cert', '/path/client.key'))\

# For docker, the file has to be in folders mapped to docker, for new folders created,
# re-run docker-compose down -v, docker-compose up to map those cert folder to docker-container

No comments:

Post a Comment