Skip to content
HTTP errors in web scraping and automation · error message

HTTP: SSL: CERTIFICATE_VERIFY_FAILED

ConfigurationClient and connection exceptions

Last verified

The exact message
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)

What it means

This is raised by Python's ssl module before any HTTP happens: the TLS handshake succeeded far enough to receive the server's certificate, but your client could not build a trusted chain from it to a root certificate it trusts. The text after the colon tells you why, most often "unable to get local issuer certificate", "self-signed certificate in certificate chain" or "certificate has expired".

Browsers often succeed where scripts fail because browsers use the operating system's trust store and can fetch missing intermediate certificates, while Python uses its own CA bundle (requests uses certifi). On macOS, the python.org installer needs its "Install Certificates" step. On corporate networks, a TLS-inspecting proxy re-signs traffic with a company root that Python does not know.

What is not wrong: the site is not blocking you, and your code logic is fine.

What it looks like

$ pip install --upgrade certifi
$ export REQUESTS_CA_BUNDLE=/etc/ssl/certs/corp-root.pem   # only if a corporate proxy re-signs TLS
$ openssl s_client -connect example.com:443 -servername example.com -showcerts

Why it happens

  • The CA bundle used by Python is missing or outdated (common on fresh macOS installs from python.org).
  • The server does not send its intermediate certificate, so the chain is incomplete.
  • A corporate proxy or antivirus intercepts TLS with its own root certificate.
  • The certificate is expired, self-signed or for a different hostname.
  • The system clock is wrong, making a valid certificate look expired or not yet valid.

How to fix it

  1. Read the reason after "certificate verify failed:" and match it to the causes above.
  2. Update the CA bundle: pip install --upgrade certifi; on macOS python.org builds, run "Install Certificates.command".
  3. Check the server's chain with openssl s_client -connect host:443 -servername host -showcerts.
  4. Behind a corporate proxy, point the client at the company root: REQUESTS_CA_BUNDLE=/path/to/corp-root.pem.
  5. Correct the system clock.
  6. Do not disable verification (verify=False) in production; it removes protection against interception.

How to stop it recurring

Pin dependency versions but update certifi regularly, bake the correct CA bundle into container images, and document any corporate root certificate in your environment setup instead of turning verification off.

Official documentation: docs.python.org/3/library/ssl.html. See all HTTP error messages.

Related errors

Definitions

Quick answers

What does "SSL: CERTIFICATE_VERIFY_FAILED" mean in HTTP?

This is raised by Python's ssl module before any HTTP happens: the TLS handshake succeeded far enough to receive the server's certificate, but your client could not build a trusted chain from it to a root certificate it trusts. The text after the colon tells you why, most often "unable to get local issuer certificate", "self-signed certificate in certificate chain" or "certificate has expired".

How do I fix "SSL: CERTIFICATE_VERIFY_FAILED"?

1. Read the reason after "certificate verify failed:" and match it to the causes above. 2. Update the CA bundle: pip install --upgrade certifi; on macOS python.org builds, run "Install Certificates.command". 3. Check the server's chain with openssl s_client -connect host:443 -servername host -showcerts. 4. Behind a corporate proxy, point the client at the company root: REQUESTS_CA_BUNDLE=/path/to/corp-root.pem. 5. Correct the system clock. 6. Do not disable verification (verify=False) in production; it removes protection against interception.

Retries and timeouts without writing the loop

Autonoly's HTTP Request node and browser steps have per-node retries, timeouts and continue-on-fail, so a transient 429 or 503 can back off instead of failing the run. It has no proxies or IP rotation: if a site blocks automated traffic, that block applies to Autonoly too.

Also see Error handling in workflows.