- Published on
Ignoring SSL Certificate Verification in Python Requests
- Authors
- Name
- Ashik Nesin
- @AshikNesin
Request is a popular package which is used for making API requests.
It comes and does various features on top of just doing API requests; one such thing is SSL Certificate Verification
What does SSL Certificate Vercel mean?
It'll verify whether the SSL certificate is valid or not before making the request. This helps to prevent issues like Man in the Middle attack and other security issues.
SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
However, you might not want this functionality for some edge cases or if you've your own signed certificate for your local development
How to disable this?
Disabling this behaviour is not recommended for production use cases. However, here is how you can do it.
Individual Request
import requests
url = "https://localhost:8000" # Or, any domain with invalid SSL
response = requests.get(url, verify=False)
Basically, just pass verify
field as false.
Disabling for Sessions
import requests
session = requests.Session()
session.verify = False
url = "https://localhost:8000" # Or, any domain with invalid SSL
response = session.get(url)
References
Happy disabling checks!