SSLError
occurs when you request a remote URL that does not provide a trusted SSL certificate. The easiest way to fix this issue is to disable SSL verification for that particular web address by passing in verify=False
as an argument to the method calls. Just make sure you are not sending any sensitive data in your request.
Here is some sample code that disables SSL verification:
import requests
response = requests.get("https://example.com/", verify=False)
You can optionally provide a custom certificate for the website to fix this error as well. Here is some sample code for providing a custom .pem
certificate file to requests
:
import requests
custom_certificate_path = "./certificates/custom-certificate.pem"
response = requests.get("https://example.com/", verify=custom_certificate_path)