1
0
Fork 0
mirror of https://github.com/Findus23/HNReader.git synced 2024-09-18 14:13:44 +02:00

fix server

This commit is contained in:
Lukas Winkler 2022-11-18 23:42:32 +01:00
parent 662bb277c1
commit a0ba5a39c5
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -12,7 +12,7 @@ from config import debug, user_agent, redis_socket, city
from hnapi import HNClient
from reader import Reader
geoip = maxminddb.open_database(Path(__file__).parent/'dbip-city-lite-2022-11.mmdb')
geoip = maxminddb.open_database(Path(__file__).parent / 'dbip-city-lite-2022-11.mmdb')
session = AsyncClient(timeout=Timeout(timeout=15.0), headers={
"User-Agent": user_agent,
@ -43,7 +43,7 @@ async def read(request: Request):
return "Url not found", 404
if not debug and (
"x-forwarded-for" not in request.headers
or not is_from_city(request.headers["x-forwarded-for"])
or not await is_from_city(request.headers["x-forwarded-for"])
):
return JSONResponse({
"title": "Reader View not public",