Skip to content

Add results page, missing routes, and resilience fixes/Fixes to App.py - #6

Merged
alede1107 merged 2 commits into
mainfrom
riya
Jul 10, 2026
Merged

Add results page, missing routes, and resilience fixes/Fixes to App.py#6
alede1107 merged 2 commits into
mainfrom
riya

Conversation

@KarandeepSingh258255

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings July 9, 2026 22:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Flask app from a JSON API-style endpoint to a server-rendered “results” flow, adds a dedicated results page UI, and introduces resiliency improvements in the flight/news/classifier service calls.

Changes:

  • Adds templates/results.html and extends static/style.css to support the results UI (flight summary, category tiles, filtering).
  • Refactors app.py to serve / and handle POST /results, rendering HTML on both success and error paths.
  • Adds retry logic in services/news.py and services/classifier.py, and improves failure handling in services/flight.py.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
templates/results.html New results page template with error states, flight summary, and article list/filtering.
static/style.css Styling for results page components and category tiles.
services/news.py Adds retry handling around the WorldNews API request.
services/flight.py Adds more defensive handling for AviationStack responses.
services/classifier.py Adds retry handling around Gemini classification requests.
app.py Adds / route and converts the results flow to server-rendered HTML via POST /results.
.gitignore Updates ignore patterns.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app.py
Comment on lines 94 to +95
if __name__ == "__main__":
app.run(debug=True)
app.run(host="0.0.0.0", port=5001, debug=True)
Comment thread services/news.py
Comment on lines +27 to +30
try:
response = requests.get(f"{BASE_URL}/search-news", params=params)
data = response.json()
break # got valid JSON back, stop retrying
Comment thread services/news.py
Comment on lines +49 to +51
articles = []

for result in data["news"]:
Comment thread services/flight.py
Comment on lines +47 to +50
response = requests.get(
f"{BASE_URL}/flights?access_key={TOKEN}&flight_iata={flight_number}"
)
data = response.json()
Comment thread templates/results.html
Comment on lines +46 to +51
{% elif stage == 'news' %}
{% if reason == 'no_local_articles' or reason == 'no_articles_found' %}
We found your flight, but couldn't find any local stories for your destination yet.
{% else %}
We found your flight, but couldn't load local news right now. Please try again shortly.
{% endif %}
Comment thread templates/results.html
Comment on lines +105 to +106
{% set slug = article.category|lower|replace(' ', '-') %}
<a class="news-card" data-category="{{ slug }}" href="{{ article.url }}" target="_blank" rel="noopener noreferrer">
Comment thread static/style.css
Comment on lines 25 to +27
@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,wght@1,500;1,600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400&display=swap');
@alede1107
alede1107 merged commit a861977 into main Jul 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants