A beginner-friendly Python command-line application that fetches real-time weather data and a short forecast for any city in the world using the OpenWeatherMap API.
╔══════════════════════════════════╗
║ Weather Dashboard CLI ║
╚══════════════════════════════════╝
Enter city name: London
Fetching weather for 'London'...
═════════════════════════════════════════════
Weather in London, GB
═════════════════════════════════════════════
Temperature : 14.2°C (Feels like 13.0°C)
Condition : Partly Cloudy
Humidity : 72%
Wind Speed : 5.1 m/s
Visibility : 10.0 km
Sunrise : 06:12
Sunset : 19:45
═════════════════════════════════════════════
Short Forecast (next ~15 hours)
───────────────────────────────────────────
Mon 15:00 | 13.5°C | Light Rain
Mon 18:00 | 12.8°C | Overcast Clouds
...
Save report to JSON? (y/n): y
Data saved to 'weather_report.json'
- Real-time temperature, feels-like, humidity, wind speed, and visibility
- Short forecast for the next ~15 hours
- Option to save weather data to a JSON file
- Friendly error messages for invalid cities or API issues
- Accepts city name as a command-line argument or via interactive prompt
git clone https://github.com/ASHISHtech-03/weather-dashboard-cli.git
cd weather-dashboard-cliMake sure you have Python 3.10+ installed, then run:
pip install -r requirements.txt- Go to https://openweathermap.org/ and create a free account.
- Navigate to API Keys in your account dashboard.
- Copy your API key.
Open weather.py and replace the placeholder on line 8:
API_KEY = "your_api_key_here" # ← Replace thisNote: Free-tier API keys may take up to 10 minutes to activate after creation.
Interactive mode (you will be prompted for a city):
python weather.pyPass city name directly:
python weather.py Mumbai
python weather.py New York
python weather.py "Kuala Lumpur"weather-dashboard-cli/
│
├── weather.py # Main application file
├── requirements.txt # Python dependencies
├── README.md # This file
└── weather_report.json # Auto-generated when you save (not committed)
- The user provides a city name.
- The app sends a GET request to the OpenWeatherMap Current Weather API.
- The JSON response is parsed and displayed in a formatted layout.
- A second API call fetches the 5-day forecast endpoint (limited to 5 time slots).
- The user can optionally save the raw JSON response to a file.
| Tool | Purpose |
|---|---|
| Python 3 | Core programming language |
requests |
HTTP API calls |
json |
Parsing and saving API responses |
datetime |
Formatting timestamps |
| OpenWeatherMap API | Weather data source |
- Requires an active internet connection.
- Free-tier API allows 60 calls/minute — more than enough for this app.
- Temperature is displayed in Celsius by default (changeable in
weather.py).
This project is open-source and available under the MIT License.
Ashish Kumar Rai
Registration No: 24BAI10666
VIT Bhopal University
Python Essentials — BYOP Capstone Project
March 2026