A professional terminal-based weather application built with Python that provides real-time weather conditions and 5-day forecasts using the OpenWeatherMap API.
| Feature | Description |
|---|---|
| Current Weather | Temperature, min/max, feels like, humidity, pressure, wind, visibility, sunrise and sunset |
| 5-Day Forecast | Daily breakdown with condition, temperatures, humidity, and wind |
| Unit Switching | Toggle between Metric (°C) and Imperial (°F) at any time |
| Country Detection | ISO country code resolved to full country name |
| Wind Direction | Compass-based wind direction indicator |
| Search History | Saves every city search with timestamp; review the last 10 anytime |
| Error Handling | Handles timeouts, invalid input, missing API key, and bad API responses |
| Application Logging | Records successful lookups and errors in logs/weather.log |
| Clean Terminal UI | Aligned, formatted tables via tabulate |
| Technology | Purpose |
|---|---|
| Python 3 | Core programming language |
| requests | HTTP API communication |
| colorama | Cross-platform terminal colors |
| tabulate | Formatted terminal tables |
| pycountry | ISO country code to name mapping |
| python-dotenv | Environment variable management |
| OpenWeatherMap API | Real-time weather data source |
Weather-App-Pro/
│
├── screenshots/
│ ├── home.png
│ ├── current_weather.png
│ ├── forecast.png
│ └── invalid_city.png
│
├── app.py # Entry point — CLI loop, display, user interaction
├── weather.py # OpenWeatherMap API calls (current and forecast)
├── utils.py # Helpers — time conversion, icons, country names
├── config.py # Environment variable loader
├── logger.py # Logging configuration
├── history.py # Search history read/write
├── requirements.txt # Python dependencies
├── README.md # This file
├── .gitignore # Git ignore rules
└── .env # API key (excluded from git)
Clone the repository:
git clone https://github.com/sanjansahdev/Weather-App-Pro.gitMove into the project directory:
cd Weather-App-ProCreate a virtual environment:
python -m venv .venvActivate the virtual environment.
Windows (PowerShell)
.venv\Scripts\Activate.ps1Linux / macOS
source .venv/bin/activateInstall dependencies:
pip install -r requirements.txtCreate a .env file in the root directory:
API_KEY=YOUR_OPENWEATHERMAP_API_KEYA free API key can be obtained at openweathermap.org/api.
python app.py| Command | Description |
|---|---|
<city> |
Search weather by city name |
unit |
Switch temperature unit between °C and °F |
history |
View recent searches |
help |
Show available commands |
exit |
Close the application |
Current Weather Table:
Current Weather — Tokyo, Japan
╭────────────────┬──────────────────────╮
│ Attribute │ Value │
├────────────────┼──────────────────────┤
│ City │ Tokyo │
│ Country │ Japan │
│ Temperature │ 36 °C │
│ Min Temp │ 35 °C │
│ Max Temp │ 36 °C │
│ Feels Like │ 41 °C │
│ Humidity │ 44% │
│ Pressure │ 1001 hPa │
│ Wind Speed │ 0.45 m/s │
│ Wind Direction │ ENE │
│ Cloud Cover │ 100% │
│ Visibility │ 10.0 km │
│ Condition │ Overcast Clouds │
│ Sunrise │ 01:17:06 AM │
│ Sunset │ 03:18:04 PM │
╰────────────────┴──────────────────────╯
5-Day Forecast Table:
5-Day Forecast
╭─────────────┬──────────────────┬────────┬───────┬───────┬────────────┬──────────╮
│ Date │ Condition │ Temp │ Min │ Max │ Humidity │ Wind │
├─────────────┼──────────────────┼────────┼───────┼───────┼────────────┼──────────┤
│ Thu, 30 Jul │ Light Rain │ 33 °C │ 31 °C │ 33 °C │ 53% │ 1.54 m/s │
│ Fri, 31 Jul │ Overcast │ 30 °C │ 30 °C │ 30 °C │ 64% │ 4.92 m/s │
│ Sat, 01 Aug │ Light Rain │ 30 °C │ 30 °C │ 30 °C │ 64% │ 3.86 m/s │
│ Sun, 02 Aug │ Light Rain │ 28 °C │ 28 °C │ 28 °C │ 71% │ 5.70 m/s │
│ Mon, 03 Aug │ Broken Clouds │ 27 °C │ 27 °C │ 27 °C │ 70% │ 4.85 m/s │
╰─────────────┴──────────────────┴────────┴───────┴───────┴────────────┴──────────╯
This project demonstrates practical experience with:
- Modular Python development
- REST API integration
- Environment variable management
- File handling and logging
- Exception handling
- Terminal application development
- Clean code organization and professional project structure
- Air Quality Index (AQI) display
- Hourly forecast
- Geolocation support
- Weather alerts
- Favorite cities
- Export weather reports to file
- Multi-language support
This project is open source and available under the MIT License.
Sanjansah Guntipelly
Computer Science Student
GitHub: github.com/sanjansahdev



