Weather application that fetches data from Tomorrow.io API and displays the fields in a specific order.
This is a simple weather app that allows users to check the current weather conditions for any location they enter. The app provides real-time data including temperature, humidity, wind speed, and more, fetched from the Tomorrow.io API.
- User input for location (city name or geographic coordinates)
- Real-time weather data fetching from the Tomorrow.io API
- Display of temperature, humidity, and wind speed and other fields.
- Error handling for invalid locations or network issues
- Responsive design for both desktop and mobile devices
- Show Air Quality Index (AQI) and pollen information for the user's current location
- Provide a 6-day weather forecast for Middle Tennessee State University (MTSU)
- Automatic refresh of weather data every 15 minutes
- Python: Backend logic
- Flask: Web application framework
- HTML/CSS: Front-end design
- JavaScript (ES6+): Front-end functionality
- Tomorrow.io API: Real-time weather data
- GeoDB Cities API: City search functionality
- Requests Library: HTTP requests to the Tomorrow.io API
The Tomorrow.io Weather API is the primary source of weather data in this application. It is used for:
- Fetching real-time weather data for searched cities
- Displaying AQI and pollen information for the user's location
- Providing a 6-day forecast for MTSU
API Key: To obtain an API key for Tomorrow.io, please contact the developers of this project.
The GeoDB Cities API is used to provide city search functionality. It allows users to search for cities and select from a list of matching results.
Follow these steps to set up and run the PYWEATHERAPP on your local machine:
- Ensure you have Python 3.7 or later installed on your system. You can download it from python.org.
- Open your terminal or command prompt.
- Clone the repository using Git:
git clone https://github.com/sp0721/PYWEATHERAPP.git
Create a virtual environment: bash python -m venv venv
Activate the virtual environment: On Windows: bash venv\Scripts\activate
On macOS/Linux: bash source venv/bin/activate
Install Flask and Requests libraries: bash pip install flask requests
Tomorrow.io API: To obtain your API key, please contact the developers of this project. GeoDB Cities API: Sign up at GeoDB Cities API to obtain your API key.
Open the app.py file in a text editor. Locate the line where the Tomorrow.io API key is defined and replace it with your actual API key: python TOMORROW_API_KEY = 'your_tomorrow_io_api_key_here'
In your terminal, ensure you are in the project directory and the virtual environment is activated. Start the Flask application: bash python app.py
Open your web browser and go to http://localhost:5000 to access the Weather App.
Enter a city name in the search bar and click "Search City" or press Enter. Select a city from the dropdown list if multiple results are found. View the current weather conditions, including temperature, humidity, wind speed, and more. Check the AQI and pollen information for your current location (requires geolocation permission). View the 6-day forecast for MTSU.
app.py: The main Flask application file. templates/index.html: The main HTML template. static/script.js: JavaScript file for frontend functionality. static/styles.css: CSS file for styling.
The MTSU widget can be customized to show weather for a different location by changing the data-location-id attribute in the HTML. The refresh interval for weather data can be adjusted by modifying the setInterval duration in the JavaScript code.
SHREEJI PATEL, OM PATEL, MEGH PATEL
Weather data provided by Tomorrow.io City search functionality powered by GeoDB Cities API Icons provided by Font Awesome