# requests.exceptions.SSLError: HTTPSConnectionPool(host='internal.example.com', port=443): 超过最大重试次数 (由SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败：证书链中存在自签名证书'))引起)

- **ID:** `python/requests-sslerror-self-signed-certificate`
- **领域:** python
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

服务器使用自签名证书，默认CA包不信任该证书。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **Provide the self-signed certificate file to verify parameter** (90% 成功率)
   ```
   requests.get('https://internal.example.com', verify='/path/to/cert.pem')
   ```
2. **Use a custom CA bundle that includes the self-signed certificate** (85% 成功率)
   ```
   requests.get('https://internal.example.com', verify='/path/to/custom-ca-bundle.crt')
   ```

## 无效尝试

- **Setting verify=False globally** — Disables security checks, making the connection vulnerable to attacks. (60% 失败率)
- **Adding the certificate to the system trust store without proper configuration** — The system trust store may not be used by Python's requests library by default. (70% 失败率)
