diff --git a/Dockerfile b/Dockerfile index b4b242d..14d7ae9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ ENV POETRY_VIRTUALENVS_CREATE=false \ WORKDIR /code RUN pip install poetry COPY pyproject.toml poetry.lock /code/ -RUN poetry install --without dev +RUN poetry install --without dev --no-root COPY geocoder_api/ /code/geocoder_api RUN groupadd -r fastapi && useradd -r -g fastapi fastapi diff --git a/geocoder_api/models/photon.py b/geocoder_api/models/photon.py index 9cb3098..29375fa 100644 --- a/geocoder_api/models/photon.py +++ b/geocoder_api/models/photon.py @@ -54,6 +54,7 @@ class MultiPolygon(BaseModel): | Literal["county"] | Literal["state"] | Literal["country"] + | Literal["other"] ) diff --git a/geocoder_api/routers/geocoding.py b/geocoder_api/routers/geocoding.py index c81f68d..535ae03 100644 --- a/geocoder_api/routers/geocoding.py +++ b/geocoder_api/routers/geocoding.py @@ -34,7 +34,7 @@ async def geocoding( float | None, Query(description="Geocode with priority to this longitude") ] = None, ) -> FeatureCollection: - async with AsyncClient() as client: + async with AsyncClient(timeout=20) as client: # Remove None-parameters params = { k: v @@ -58,7 +58,7 @@ async def reverse_geocoding( lon: Annotated[float, Query(description="Longitude")], shared_params: Annotated[dict, Depends(get_shared_query_params)], ) -> FeatureCollection: - async with AsyncClient() as client: + async with AsyncClient(timeout=20) as client: # Remove None-parameters params = { k: v diff --git a/geocoder_api/routers/healthcheck.py b/geocoder_api/routers/healthcheck.py index 9872dd1..8ebefd9 100644 --- a/geocoder_api/routers/healthcheck.py +++ b/geocoder_api/routers/healthcheck.py @@ -9,7 +9,7 @@ def photon_healthcheck() -> (bool, str): - with Client() as client: + with Client(timeout=20) as client: params = {"q": "berlin"} res = client.get(f"{settings.photon_url}/api", params=params) if res.status_code == 200: