# aiohttp.client_exceptions.TooManyRedirects: 0, message='Too many redirects', url=URL('https://example.com/')

- **ID:** `python/aiohttp-toomanyredirects`
- **Domain:** python
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The server returns a redirect loop (or more than max_redirects hops), typically due to HTTP-to-HTTPS misconfiguration or cookie/session requirements.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.9+ | active | — | — |

## Workarounds

1. **** (88% success)
   ```
   async with session.get(url, allow_redirects=False) as r:
    print(r.status, r.headers.get('Location'))
# follow manually and correct the base URL or auth cookie
   ```
2. **** (75% success)
   ```
   session.cookie_jar.update_cookies({'session': token})
async with session.get(url) as r:
    ...
   ```

## Dead Ends

- **** — A true redirect loop never terminates; raising the limit only delays the failure and wastes requests. (80% fail)
- **** — You then receive the 3xx response body instead of the target content, so the fetch still fails functionally. (65% fail)
