# 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.', OSError('Tunnel connection failed: 407 Proxy Authentication Required')))

- **ID:** `python/requests-connectionerror-proxy-authentication`
- **Domain:** python
- **Category:** auth_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The proxy requires authentication credentials, but none were provided.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **Include username and password in the proxy URL** (95% success)
   ```
   proxies = {'http': 'http://user:password@proxy.example.com:8080'}
requests.get('http://target.com', proxies=proxies)
   ```
2. **Use the requests.auth.HTTPProxyAuth class** (90% success)
   ```
   from requests.auth import HTTPProxyAuth
auth = HTTPProxyAuth('user', 'password')
requests.get('http://target.com', proxies={'http': 'http://proxy.example.com:8080'}, auth=auth)
   ```

## Dead Ends

- **Setting the proxy URL without credentials** — The proxy server explicitly rejects connections without authentication. (95% fail)
- **Using an environment variable HTTP_PROXY without authentication** — Environment variables also need credentials if the proxy requires them. (90% fail)
