python
network_error
ai_generated
partial
requests.exceptions.ConnectionError: HTTPConnectionPool(host='proxy.example.com', port=8080): Max retries exceeded with url: http://target.com/ (Caused by ProxyError('Cannot connect to proxy.', ConnectionResetError(104, 'Connection reset by peer')))
ID: python/requests-connectionerror-proxy-connection-reset
80%Fix Rate
86%Confidence
0Evidence
2024-11-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
The proxy server abruptly closed the connection, possibly due to timeout or overload.
generic中文
代理服务器突然关闭连接,可能是由于超时或过载。
Workarounds
-
85% success Use a different proxy server
proxies = {'http': 'http://new-proxy.example.com:8080'} requests.get('http://target.com', proxies=proxies) -
75% success Add a delay between connection attempts to avoid overwhelming the proxy
import time for _ in range(3): try: response = requests.get('http://target.com', proxies=proxies) break except requests.exceptions.ConnectionError: time.sleep(2)
Dead Ends
Common approaches that don't work:
-
Retrying immediately with the same proxy
80% fail
The proxy may still be overloaded or resetting connections.
-
Increasing the number of retries
70% fail
Retries may succeed temporarily but the underlying proxy issue persists.