Skip to content

Commit

Permalink
Correct unwanted cache of news
Browse files Browse the repository at this point in the history
  • Loading branch information
igormcsouza committed Mar 22, 2023
1 parent 7089647 commit 7246911
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,7 @@ dmypy.json
.pytype/

# Cython debug symbols
cython_debug/
cython_debug/*.swp

**/*.swp

3 changes: 2 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand All @@ -51,3 +51,4 @@ def fetch(body: RequestBody) -> ResponseType:
parse = [(t['title'], t['link'], t['date']) for t in top]

return {'headlines': parse}

0 comments on commit 7246911

Please sign in to comment.