A simple Flask-based REST API that fetches real-time weather forecasts using Open-Meteo. Supports city name or coordinates input, provides human-readable weather descriptions, and returns neatly formatted data with units.
- Fetches current weather data for a given location
- Uses Open-Meteo API for weather data
- Simple and modular project structure
- Easy to extend and modify
- Python 3.8+
pippackage manager
- Clone the repository:
git clone https://github.com/0then0/WeatherFlask cd WeatherFlask - 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 -r requirements.txt
- Run the application:
python run.py
- The API will be available at
http://127.0.0.1:5000/
Send a GET request to fetch weather data:
GET /weather?lat=37.7749&lon=-122.4194
Example response:
{
"City": "San Francisco",
"Coordinates": "Lat: 37.7893°N Lon: -122.422°E",
"Current apparent temperature": "7.1°C",
"Current temperature": "9.3°C",
"Current weather code": 3,
"Current wind speed": "10.8 km/h",
"Last update": "2025-03-22 14:45:00",
"Weather description": "Overcast"
}