python
network_error
ai_generated
true
requests.exceptions.SSLError: HTTPSConnectionPool(host='internal.example.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain')))
ID: python/requests-sslerror-self-signed-certificate
80%Fix Rate
86%Confidence
0Evidence
2024-07-22First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
The server uses a self-signed certificate that is not trusted by the default CA bundle.
generic中文
服务器使用自签名证书,默认CA包不信任该证书。
Workarounds
-
90% success Provide the self-signed certificate file to verify parameter
requests.get('https://internal.example.com', verify='/path/to/cert.pem') -
85% success Use a custom CA bundle that includes the self-signed certificate
requests.get('https://internal.example.com', verify='/path/to/custom-ca-bundle.crt')
Dead Ends
Common approaches that don't work:
-
Setting verify=False globally
60% fail
Disables security checks, making the connection vulnerable to attacks.
-
Adding the certificate to the system trust store without proper configuration
70% fail
The system trust store may not be used by Python's requests library by default.