The Daily Holiday Viewer is a Flask-based application that fetches and displays holiday observances for specific dates using Wikipedia's MediaWiki Action API. It allows users to explore cultural and historical holidays, search for specific dates, and contribute new holiday entries to a test Wikipedia page.
- App Overview
- Architecture Overview
- Dependencies
- How It Works
- Step-by-Step Guide
- MediaWiki API Endpoints
- Next Steps
The Daily Holiday Viewer enables users to:
- π View holidays and observances for today or any specific date.
- π Search for holidays by month and day.
- βοΈ Log in to add new holidays to a test Wikipedia page.
- π¨ Experience a clean and responsive UI built with Bootstrap and Materialize icons.
The application uses a Python Flask backend to handle routes and API requests. It integrates with the MediaWiki API to fetch holiday data and dynamically renders templates using Jinja2. The frontend leverages Bootstrap for responsive design and jQuery for interactive elements like link management.
- Flask: Web framework for handling routes and rendering templates.
- Requests: Python library for making HTTP requests to the MediaWiki API.
- Bootstrap: Provides a modern and responsive UI.
- jQuery: Enables dynamic interactions and link updates.
- Material Icons: Adds intuitive navigation and action icons.
- Homepage: Displays holidays for todayβs date by default.
- Search: Users can select a date to retrieve holidays for that day.
- Add Holidays: Authenticated users can add new holidays to a test page.
- Dynamic Rendering: Backend fetches data and renders it into the templates using Jinja2.
- File:
app.py
Initialize the Flask app with routes for:- π Displaying holidays.
- π Searching for holidays.
- π Logging in to Wikipedia.
- βοΈ Adding new holidays.
- File:
templates/layout.html
Create a base HTML layout with:- π¨ Bootstrap for responsive design.
- πΌοΈ Materialize icons for navigation and actions.
- File:
templates/index.html
Fetch holidays from Wikipedia using the MediaWiki Action API.
Display the holidays for:- π Todayβs date.
- π User-selected date (optional).
- File:
templates/search.html
Add a search form allowing users to:- π Select a month.
- π Select a day.
Fetch and display holidays for the specified date.
- File:
templates/add.html
Allow authenticated users to:- βοΈ Add holidays to a test page on Wikipedia using the API:Edit endpoint.
- β¨ Highlight added holidays in bold.
- File:
templates/login.html
Authenticate users with the API:ClientLogin endpoint.
- File:
static/style.css
Apply custom CSS for:- π¨ A visually appealing UI.
- π± Mobile-friendly responsiveness.
- Retrieve section data and content for holidays.
- Authenticate users for adding holidays.
- Add new holidays to a test Wikipedia page.
Expand Features
π Add user accounts and permissions for better user management.
π Integrate analytics to track popular holidays and user activity.
Enhance Visualization
π Use charts or timelines to visualize holidays by:
π
Date.
ποΈ Category.
Improve API Integration
π Implement caching to reduce API calls for frequently accessed holidays.