HTTP: SSL: CERTIFICATE_VERIFY_FAILED
Last verified
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 -showcertsWhy 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
- Read the reason after "certificate verify failed:" and match it to the causes above.
- Update the CA bundle: pip install --upgrade certifi; on macOS python.org builds, run "Install Certificates.command".
- Check the server's chain with openssl s_client -connect host:443 -servername host -showcerts.
- Behind a corporate proxy, point the client at the company root: REQUESTS_CA_BUNDLE=/path/to/corp-root.pem.
- Correct the system clock.
- 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
- ConnectionResetError: Connection reset by peerrequests.exceptions.ConnectionError: ('Connection aborted.',…
- Max retries exceeded with urlrequests.exceptions.ConnectionError: HTTPSConnectionPool(host='example.com',…
- 407 Proxy Authentication RequiredProxyError('Unable to connect to proxy', OSError('Tunnel connection failed:…
Definitions
- CAPTCHACAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) is a challenge-response m
- Cloudflare Bot ManagementCloudflare Bot Management is the set of Cloudflare features (Bot Fight Mode, Super Bot Fight Mode and the Ente
- DataDomeDataDome is a commercial bot-protection service that scores every request to a website, app or API in real tim
- HUMAN Security (PerimeterX)PerimeterX, now HUMAN Security's Bot Defender after a 2022 merger, is a bot-protection service that scores eve
- User AgentA user agent is a string that browsers send with every HTTP request identifying the browser type, version, and
- AI Web ScraperAn AI web scraper is an AI-powered data extraction tool that understands page structure, identifies relevant d
- Data ScrapingData scraping is the broad practice of programmatically extracting data from any digital source — websites, ap
- Web CrawlerA web crawler (also called a spider or bot) is a program that systematically browses the internet by following
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.