Skip to content

Updated

Python requests SSLError Through a Proxy:
Causes and Fixes

  1. requests checks every HTTPS certificate by default and raises SSLError when the check fails.
  2. Behind a proxy this usually means one of three things: your CA list is out of date (upgrade certifi), something on your network re-signs TLS and its root CA is missing from Python's list (point verify or REQUESTS_CA_BUNDLE at that CA file), or the proxy URL is wrong, so the error is really about the proxy leg.
  3. Setting verify=False hides the symptom and removes the protection, so use it only for a throwaway test.

Check it right after buyingExample output

curl -x http://USER:PASS@HOST:PORT https://ipinfo.io/json

ip
203.0.113.24
country
US
Matches the country you picked
Day 15
203.0.113.24
Same address for the whole term
Example addresses (203.0.113.0/24), not real exits
01 / 09Read the error text first

Read the SSLError text, decide whether it is the CA list, a re-signing proxy or the clock, and fix that without turning verification off.

Read the error text first

CERTIFICATE_VERIFY_FAILED with unable to get local issuer certificate means Python does not have the CA that signed the chain. A message that the hostname does not match means the certificate belongs to a different name. If the traceback starts with ProxyError, the failure is on the leg to the proxy, so check host, port and protocol before touching certificates.

Remember that requests uses certifi's bundle, not necessarily the operating system store. A site that opens in your browser can still fail in Python for exactly that reason.

Cause, symptom and fix

Cause, symptom and fix
ItemWhat you seeFix
Old CA listCERTIFICATE_VERIFY_FAILED on one site, browser opens it finepip install --upgrade certifi requests
TLS inspection on your network or deviceEvery HTTPS site fails behind this network; browser shows the company or security product as issuerGet the root CA as a PEM file and set verify= or REQUESTS_CA_BUNDLE
HTTPS proxy with its own certificateError mentions the proxy; you wrote https:// in the proxy URLUse the proxy CA file, or switch to an http:// proxy URL for a normal tunnel
Wrong proxy URL or protocolProxyError or connection errors, not a certificate messageFix scheme, host, port (HTTP 2222, SOCKS5 3333 on Proxy302)
Wrong date or timeCertificate has expired or is not yet valid, on every siteCorrect the clock, then rerun

Compiled on 20 November 2026 from the Requests documentation; the fixes are the ones it describes (verify, REQUESTS_CA_BUNDLE, certifi).

A proxied request with default verification

import requests

proxies = {
    "http": "http://LOGIN:PASSWORD@HOST:PORT",
    "https": "http://LOGIN:PASSWORD@HOST:PORT",  # the proxy URL scheme stays http://
}

# Where does requests look for trusted CAs right now?
from requests.utils import DEFAULT_CA_BUNDLE_PATH
print(DEFAULT_CA_BUNDLE_PATH)

# Normal case: default verification, certifi bundle
r = requests.get("https://ipinfo.io/json", proxies=proxies, timeout=(10, 30))
print(r.status_code, r.text[:200])

Example only: replace LOGIN, PASSWORD, HOST and PORT with the values from your proxy page. The proxy URL starts with http:// even for the https key; that is how Requests describes an HTTP proxy.

Trust a re-signing CA without turning verification off

import requests

proxies = {
    "http": "http://LOGIN:PASSWORD@HOST:PORT",
    "https": "http://LOGIN:PASSWORD@HOST:PORT",
}

# Something on your side re-signs TLS: trust ITS root CA for this session
s = requests.Session()
s.proxies.update(proxies)
s.verify = "/path/to/inspection-root-ca.pem"   # PEM file from your IT team or tool
print(s.get("https://ipinfo.io/json", timeout=(10, 30)).status_code)

# Same idea without touching code (shell):
#   export REQUESTS_CA_BUNDLE=/path/to/inspection-root-ca.pem
#   python your_script.py

Example only. The PEM file is the root CA of the product or team that inspects your traffic. REQUESTS_CA_BUNDLE replaces the list, so use a bundle that also contains the public CAs you need.

Fix it in this order

  1. Step 1: upgrade certifi and requests

    Run pip install --upgrade certifi requests. The Requests docs recommend upgrading certifi frequently.

    Expected result The error disappears if the CA list was just old.

  2. Step 2: print where requests looks

    Print requests.utils.DEFAULT_CA_BUNDLE_PATH. If REQUESTS_CA_BUNDLE or CURL_CA_BUNDLE is set in your shell or container, it overrides the default.

    Expected result You know which file is used.

  3. Step 3: find the issuer

    Open the same URL in a browser or run curl -v through the same proxy and read the issuer. A security product or company name means you need its root CA file.

    Expected result You know whose CA is missing.

  4. Step 4: pass the CA file

    Use verify="/path/ca.pem" or session.verify, or export REQUESTS_CA_BUNDLE. Note that the prepared-request flow does not read the environment variable unless you merge environment settings.

    Expected result The request succeeds with verification still on.

    Before continuing Never ship verify=False to production.

Common traps

verify=False makes it work

Check The request passes but accepts any certificate, including a forged one.

Fix Replace it with the right CA file once the test is done.

Stop when Stop using it for anything that carries logins or personal data.

It works in the browser but not in Python

Check Browsers use the system store, Requests uses certifi.

Fix Upgrade certifi or point verify at the CA file.

Stop when If the browser warns too, the site or the clock is the issue.

REQUESTS_CA_BUNDLE seems ignored

Check You may be using a prepared request, or the variable is set in another shell.

Fix Set verify on the session, or merge environment settings.

Stop when If it still fails, print the path and test with curl.

SOCKS proxy raises a missing-dependency error

Check Plain requests does not include SOCKS support.

Fix Install requests[socks] and use socks5h:// if the proxy should resolve names.

Stop when If you only need HTTP, use the HTTP port.

With Proxy302: a proxy URL that keeps verification on

  1. Step 1

    Open My assets and copy HOST, PORT, USERNAME and PASSWORD.

  2. Step 2

    Build the proxy URL as http://USERNAME:PASSWORD@HOST:PORT for the port that matches the asset protocol (HTTP 2222; for SOCKS5 use socks5h:// and port 3333 with requests[socks]).

  3. Step 3

    Request https://ipinfo.io/json with the default verification and a timeout. The exit IP in the answer confirms the proxy works.

Python requests SSL error: common questions

Why does SSLError appear only when I use a proxy?

Because something between you and the site changes the certificate chain Python sees, usually inspection software, or the proxy URL is wrong. Without that layer, the public CA list is enough.

What is the difference between verify=True, a path and verify=False?

True uses the certifi bundle, a path uses the CA file you give it, and False accepts any certificate and ignores hostname mismatches and expired certificates.

Should I add the CA to the system store instead?

Requests reads certifi unless you point it elsewhere, so a system-store change may not help. Passing the file through verify or REQUESTS_CA_BUNDLE is the documented route.

Can I suppress the warning instead?

Hiding InsecureRequestWarning does not restore the protection. Fix the CA instead.

How do I test the proxy outside Python?

Run curl -v -x http://LOGIN:PASSWORD@HOST:PORT https://ipinfo.io/json and compare the issuer line with a direct run.

Further reading

Setup guides Proxy302 publishes on GitHub on the same topic:

Reference links

3
  1. Requests docs: Advanced usage (SSL, proxies, CA certificates)

    Official documentation · Confirmed on:

    Read on 20 November 2026: Requests verifies HTTPS certificates by default and raises SSLError; verify accepts a path to a CA bundle; REQUESTS_CA_BUNDLE then CURL_CA_BUNDLE can set it; verify=False accepts any certificate and the docs warn it exposes you to man-in-the-middle attacks; certificates come from certifi, which the docs recommend upgrading often; using a proxy for https typically needs the local machine to trust the proxy's root certificate; proxy URLs must include the scheme; SOCKS needs requests[socks] and socks5h resolves names on the proxy; the prepared-request flow ignores REQUESTS_CA_BUNDLE.

  2. curl: SSL certificate verification

    Official documentation · Confirmed on:

    Read on 20 November 2026: curl verifies by default and its page advises never skipping verification in production; useful for testing the same proxy outside Python.

  3. Proxy302 product facts and price list

    Product observation · Confirmed on:

    Product facts file of the site (values checked against the console, the backend and the price table on 18-19 October 2026): products, prices in US$ (1 PTC = US$1), lease terms, protocols and ports, countries, quantity limits, no free trial.

Ready to try it?

Create an account, top up once, then pick rotating residential, static ISP or datacenter IPs and have one running in your browser within minutes.