Fix FastAPI response model for geolocate endpoint
Union return type GeolocateOut | Response is not a valid Pydantic field type. Use explicit response_model decorator parameter instead.
This commit is contained in:
parent
d22d451c69
commit
a445df453e
@ -31,8 +31,8 @@ def _client_ip(request: Request) -> str | None:
|
|||||||
return request.client.host if request.client else None
|
return request.client.host if request.client else None
|
||||||
|
|
||||||
|
|
||||||
@router.get("/geolocate")
|
@router.get("/geolocate", response_model=GeolocateOut, responses={204: {}})
|
||||||
def geolocate(request: Request) -> GeolocateOut | Response:
|
def geolocate(request: Request):
|
||||||
"""Return approximate location from client IP, or 204 if unavailable.
|
"""Return approximate location from client IP, or 204 if unavailable.
|
||||||
|
|
||||||
Synchronous endpoint: geoip2 Reader.city() does mmap I/O which would
|
Synchronous endpoint: geoip2 Reader.city() does mmap I/O which would
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user