dane w headerach i inne funkcje
This commit is contained in:
@@ -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"
|
||||
|
Reference in New Issue
Block a user