This application allows users to search for movies and retrieve both movie information and historical weather data for the movie's release date. It uses The Movie Database (TMDB) API for movie data and Open-Meteo for historical weather information.
- Search movies by title
- Display movie release date and genres
- Show historical weather data for the movie's release date
- Send search data to a webhook for tracking
- Error handling with modal displays
- Python 3.8 or higher
- FastAPI
- HTTPX
- A TMDB API Bearer Token
- Clone the repository:
git clone <repository-url>
cd movie-weather-app
- Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
- Install dependencies:
pip install fastapi uvicorn httpx python-dotenv
- Create a
.env
file in the root directory with your TMDB API token:
TMDB_BEARER_TOKEN=your_tmdb_token_here
- Start the server:
uvicorn main:app --reload
- Open your web browser and navigate to:
http://localhost:8000
- Enter a movie title in the search box
- Click the "Search" button or press Enter
- The application will display:
- Movie title
- Release date
- Movie genres
- Historical weather data for the release date (temperature in Medellín, Colombia)
GET /
: Serves the main application pageGET /search_movie/?title={movie_title}
: Searches for a movie and returns movie and weather data
- User enters a movie title
- Application queries TMDB API for movie information
- If a movie is found, it retrieves historical weather data for the release date
- Data is displayed in a modal window
- Search data is sent to a webhook for tracking
- Displays error messages in a modal for:
- Movie not found
- API connection issues
- Invalid responses
- Frontend: HTML, CSS, JavaScript
- Backend: Python with FastAPI
- APIs Used:
- TMDB API for movie data
- Open-Meteo API for historical weather data
- Webhook integration for data tracking
- Weather data is specific to Medellín, Colombia (coordinates: 6.2442, -75.5812)
- The application uses modern async/await patterns for API calls
- CORS is enabled for all origins