SSLCertVerifyError: Certificate Verify Failed

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED]

Quick Answer

SSL certificate verification failed. The certificate may be expired, self-signed, or the CA bundle outdated. Fix the certificate rather than disabling verification.

Why This Happens

Python verifies SSL certificates by default. This error occurs when the certificate is expired, self-signed, or from an untrusted CA.

The Problem

import requests
response = requests.get('https://self-signed.example.com')

The Fix

import requests
# Update CA certs: pip install --upgrade certifi

# For custom CA:
response = requests.get('https://example.com', verify='/path/to/ca.crt')

# Dev only (not production!):
response = requests.get('https://localhost:8443', verify=False)

Step-by-Step Fix

  1. 1

    Update CA certificates

    pip install --upgrade certifi.

  2. 2

    Check the certificate

    Verify it is valid and from a trusted CA.

  3. 3

    Provide custom CA bundle

    Point verify= to your CA file.

Bugsly catches this automatically

Bugsly's AI analyzes this error pattern in real-time, explains what went wrong in plain English, and suggests the exact fix — before your users even report it.

Try Bugsly free