diff --git a/.gitignore b/.gitignore index 5391d87..4e0b91e 100644 --- a/.gitignore +++ b/.gitignore @@ -135,4 +135,7 @@ dmypy.json .pytype/ # Cython debug symbols -cython_debug/ \ No newline at end of file +cython_debug/*.swp + +**/*.swp + diff --git a/app.py b/app.py index e0cd4fd..acc61e1 100644 --- a/app.py +++ b/app.py @@ -8,7 +8,6 @@ app = FastAPI(debug=True if getenv("ENVIRONMENT") == "DEVELOP" else False) -googlenews = GoogleNews(lang='en', period="7d", encode='utf-8') app.add_middleware( @@ -40,6 +39,7 @@ class ResponseBody(BaseModel): @app.post("/fetch") def fetch(body: RequestBody) -> ResponseType: + googlenews = GoogleNews(lang='en', period="7d", encode='utf-8') try: googlenews.get_news(body.topic) @@ -51,3 +51,4 @@ def fetch(body: RequestBody) -> ResponseType: parse = [(t['title'], t['link'], t['date']) for t in top] return {'headlines': parse} +