Add web-verification

This commit is contained in:
Nexus 2023-02-23 11:17:54 +00:00
parent f2780d1f44
commit 6919bc3f15
Signed by: nex
GPG key ID: 0FA334385D0B689F
2 changed files with 3 additions and 2 deletions

View file

@ -100,6 +100,7 @@ if __name__ == "__main__":
app,
host=getattr(config, "HTTP_HOST", "127.0.0.1"),
port=getattr(config, "HTTP_PORT", 3762),
loop="asyncio",
**getattr(config, "UVICORN_CONFIG", {})
)
server = uvicorn.Server(http_config)

View file

@ -112,7 +112,7 @@ async def authenticate(req: Request, code: str = None, state: str = None):
# Now send a request to https://ip-api.com/json/{ip}?fields=17136
response = app.state.http.get(
f"https://ip-api.com/json/{req.client.host}?fields=17136"
f"http://ip-api.com/json/{req.client.host}?fields=17136"
)
if response.status_code != 200:
raise HTTPException(
@ -123,7 +123,7 @@ async def authenticate(req: Request, code: str = None, state: str = None):
if data["status"] != "success":
raise HTTPException(
status_code=500,
detail="Failed to get IP data."
detail=f"Failed to get IP data for {req.client.host}: {data}."
)
# Now we can update the student entry with this data