# AttributeError: 'Request' object has no attribute 'client_ip'

- **ID:** `python/starlette-request-client`
- **Domain:** python
- **Category:** attribute_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

在 Starlette 中错误地访问 request.client_ip，实际属性是 request.client.host。

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   client_ip = request.client.host if request.client else None
   ```
2. **** (80% success)
   ```
   client_ip = request.headers.get('x-forwarded-for', request.client.host if request.client else '')
   ```

## Dead Ends

- **** — 该属性也不存在。 (90% fail)
- **** — 某些情况下 client 可能为 None。 (40% fail)
