Skip to content

A beginner-friendly Python Weather CLI App using OpenWeatherMap API. Get real-time weather by city, save search history, and use .env for secure API keys. Built with requests, dotenv, and file handling.

License

Notifications You must be signed in to change notification settings

Rumaisas-islam/weather-cli-app-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⛅ Weather CLI App (Python)

Weather CLI Banner GitHub Repo stars GitHub forks GitHub license GitHub last commit Python

A sleek Weather CLI Application using Python and OpenWeatherMap API.
Built with real-time weather updates, search history, .env support — great for beginners & API learners!


📌 Features

  • 🌤️ Real-time weather data by city name
  • 🌡️ Temperature in Celsius (converted from Kelvin)
  • ✅ API integration using .env file
  • 📝 Saves search history (last 10 entries)
  • 📂 Creates history.txt automatically
  • ⚠️ Error handling for wrong cities & network issues
  • 🧠 Beginner-friendly, modular, secure

🚀 How to Run

1. Clone the repo

git clone https://github.com/Rumaisas-islam/weather-cli-app.git
cd weather-cli-app

2. Install dependencies

pip install requests python-dotenv

3. Create a .env file in the root

API_KEY=your_openweathermap_api_key_here

❗ Don’t share this file — it's already excluded by .gitignore.

4. Run the application

python weather_app.py

⚙️ Project Structure

weather-cli-app/
├── weather_app.py          # Main Python script
├── .env                    # Contains your API key (excluded from Git)
├── .env.example            # Sample template
├── history.txt             # Created automatically on first run
├── .gitignore
├── LICENSE
├── README.md
└── test/
    └── test_weather_app.py (optional)

📷 Sample Output

--- Weather CLI App ---
1. Check Weather
2. View Search History
3. Exit

Enter your choice (1-3): 1
Enter city name: Karachi

🌤️ Weather in Karachi at 2025-07-09 06:55:53
Temperature: 28.33°C
Condition: Scattered Clouds

🧠 Technologies Used

  • Python 3.x
  • OpenWeatherMap API
  • requests, python-dotenv
  • File Handling
  • Command Line Interface

🏗️ Future Enhancements

  • Add ASCII/emoji icons for weather
  • Weekly forecasts
  • Export to CSV/JSON
  • Add color styling with colorama
  • GUI version using Tkinter

🧾 License

Licensed under the MIT License — see the LICENSE file.


🙌 Support

If this helped you, give the repo a ⭐ and share with others! PRs and contributions are warmly welcome.


🏷️ Tags

#python #weather-api #cli-app #openweathermap #file-handling #api-integration #beginner-project

About

A beginner-friendly Python Weather CLI App using OpenWeatherMap API. Get real-time weather by city, save search history, and use .env for secure API keys. Built with requests, dotenv, and file handling.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages