From 7a5532208ed8a3b19c9c4f68bfe7c1cd8f5a2f3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liisa=20R=C3=A4tsep?= Date: Fri, 16 Feb 2024 10:19:17 +0200 Subject: [PATCH] update packages; fix cors configuration --- app/app.py | 7 +++---- app/config.py | 3 ++- requirements.txt | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/app.py b/app/app.py index 96ac8c4..069e667 100755 --- a/app/app.py +++ b/app/app.py @@ -7,7 +7,7 @@ app = FastAPI( title="Grammatical Error Correction", - version=api_settings.version, + version=api_settings.version if api_settings.version else "dev", description="A service that performs automatic grammatical error correction." ) @@ -15,8 +15,7 @@ CORSMiddleware, allow_origins=["*"], allow_methods=["*"], - allow_headers=["*"], - allow_credentials=True, + allow_headers=["*"] ) @@ -42,7 +41,7 @@ async def shutdown(): @app.get('/health/startup', include_in_schema=False) @app.get('/health/liveness', include_in_schema=False) async def health_check(): - # Returns 200 the connection to RabbitMQ is up + # Returns 200 if connection to RabbitMQ is up if mq_connector.channel is None or mq_connector.channel.is_closed: raise HTTPException(500) return "OK" diff --git a/app/config.py b/app/config.py index efe9e75..ff70c8e 100755 --- a/app/config.py +++ b/app/config.py @@ -1,3 +1,4 @@ +from typing import Optional from pydantic import BaseSettings, validator @@ -14,9 +15,9 @@ class Config: class APISettings(BaseSettings): - version: str max_input_length: int = 10000 languages: str = "et" # comma-separated list of 2-letter codes + version: Optional[str] @validator('languages') def list_languages(cls, v): diff --git a/requirements.txt b/requirements.txt index 06482f0..e85c427 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -aio-pika==8.0.3 -fastapi==0.78.0 -uvicorn==0.18.2 -pydantic==1.9.1 \ No newline at end of file +aio-pika==9.4.0 +fastapi==0.109.2 +uvicorn==0.27.1 +pydantic<2.0.0 \ No newline at end of file