This API provides a simple way to obtain weather forecast data for a specific city. Built with Python and Flask, it fetches accurate weather information from OpenWeatherMap.
- City-based Forecast: Retrieve weather forecasts by providing the name of the city.
- Simplicity: Easy to use with a single query parameter.
- Error Handling: Gracefully handles errors for a smooth user experience.
- Python 3.x installed on your system.
- An API key from OpenWeatherMap. Obtain one here.
-
Install dependencies:
pip install Flask requests
-
Replace API_KEY placeholder:
- Open
app.pyin a text editor. - Replace
'YOUR_API_KEY'with your actual OpenWeatherMap API key.
- Open
-
Start the API:
python app.py
This will start the Flask development server.
-
Make a GET request:
Use your preferred tool (e.g., Postman, cURL) to make a GET request to:
GET /weather?city=CityName
Replace
CityNamewith the desired city parameter. -
Receive weather forecast data in the response.
-
GET /weather
Parameters:
city: City name (required)
Example:
GET /weather?city=London
SCREENSHOTS:

