Skip to content

Commit

Permalink
Merge pull request #17 from igormcsouza/issue-15
Browse files Browse the repository at this point in the history
Correct unwanted cache of news
  • Loading branch information
igormcsouza authored Mar 22, 2023
2 parents fb4110c + 7246911 commit dfed8de
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 dfed8de

Please sign in to comment.