dane w headerach i inne funkcje
This commit is contained in:
@@ -6,6 +6,7 @@ from .geo import reload_provider
|
|||||||
import secrets
|
import secrets
|
||||||
import ipaddress
|
import ipaddress
|
||||||
import re
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
security = HTTPBasic()
|
security = HTTPBasic()
|
||||||
@@ -169,6 +170,7 @@ async def my_ip(request: Request, geo=Depends(get_geo)):
|
|||||||
body = json.dumps(data, ensure_ascii=False) + "\n"
|
body = json.dumps(data, ensure_ascii=False) + "\n"
|
||||||
return Response(content=body, media_type="application/json", headers=headers)
|
return Response(content=body, media_type="application/json", headers=headers)
|
||||||
|
|
||||||
|
|
||||||
@router.api_route('/ip/{ip_address}', methods=["GET", "HEAD"])
|
@router.api_route('/ip/{ip_address}', methods=["GET", "HEAD"])
|
||||||
async def ip_lookup(ip_address: str, geo=Depends(get_geo)):
|
async def ip_lookup(ip_address: str, geo=Depends(get_geo)):
|
||||||
data = geo.lookup(ip_address)
|
data = geo.lookup(ip_address)
|
||||||
|
Reference in New Issue
Block a user