Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather App Pro

A professional terminal-based weather application built with Python that provides real-time weather conditions and 5-day forecasts using the OpenWeatherMap API.


Preview

Home Screen

Home Screen

Current Weather

Current Weather

5-Day Forecast

5-Day Forecast

Invalid City Handling

Invalid City


Features

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

Technologies Used

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

Project Structure

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)

Installation

Clone the repository:

git clone https://github.com/sanjansahdev/Weather-App-Pro.git

Move into the project directory:

cd Weather-App-Pro

Create a virtual environment:

python -m venv .venv

Activate the virtual environment.

Windows (PowerShell)

.venv\Scripts\Activate.ps1

Linux / macOS

source .venv/bin/activate

Install dependencies:

pip install -r requirements.txt

Create a .env file in the root directory:

API_KEY=YOUR_OPENWEATHERMAP_API_KEY

A free API key can be obtained at openweathermap.org/api.


Running the Application

python app.py

Available Commands

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

Sample Output

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 │
╰─────────────┴──────────────────┴────────┴───────┴───────┴────────────┴──────────╯

Skills Demonstrated

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

Future Improvements

  • Air Quality Index (AQI) display
  • Hourly forecast
  • Geolocation support
  • Weather alerts
  • Favorite cities
  • Export weather reports to file
  • Multi-language support

License

This project is open source and available under the MIT License.


Author

Sanjansah Guntipelly

Computer Science Student

GitHub: github.com/sanjansahdev

About

A professional terminal-based weather application built with Python.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages