dane w headerach i inne funkcje

This commit is contained in:
Mateusz Gruszczyński
2025-10-09 16:55:56 +02:00
parent 941937354c
commit 559ef2e2c0

View File

@@ -163,7 +163,7 @@ def get_client_ip(request: Request) -> str:
async def my_ip(request: Request, geo=Depends(get_geo)):
ip = get_client_ip(request) # pobieranie IP:contentReference[oaicite:0]{index=0}
data = geo.lookup(ip) # geo lookup:contentReference[oaicite:1]{index=1}:contentReference[oaicite:2]{index=2}
headers = _geo_headers(data)
headers = geo_headers(data)
if request.method == "HEAD":
return Response(status_code=200, headers=headers)
body = json.dumps(data, ensure_ascii=False) + "\n"
@@ -172,7 +172,7 @@ async def my_ip(request: Request, geo=Depends(get_geo)):
@router.api_route('/ip/{ip_address}', methods=["GET", "HEAD"])
async def ip_lookup(ip_address: str, geo=Depends(get_geo)):
data = geo.lookup(ip_address)
headers = _geo_headers(data)
headers = geo_headers(data)
if request.method == "HEAD":
return Response(status_code=200, headers=headers)
body = json.dumps(data, ensure_ascii=False) + "\n"