Skip to content

A simple and fun command-line tool to check the current weather for any city using the OpenWeatherMap API. Built with Python 🐍.

License

Notifications You must be signed in to change notification settings

Gggghgggh/weather-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

☁️ Weather CLI Tool (Python)

A simple and fun command-line tool to check the current weather for any city using the OpenWeatherMap API. Built with Python 🐍.


✨ Demo

  $ python weather.py Nairobi
  Weather in Nairobi:
  🌀  Clear sky  
  🌑️  Temperature: 25°C  
  πŸ’¨  Wind: 5.2 m/s  
  πŸ’§  Humidity: 58%

πŸ”§ Features

β€’ Get current weather conditions for any city

β€’ Uses OpenWeatherMap API for real-time data

β€’ Easy to use, lightweight, and extensible

β€’ Can be extended into a web API or app

πŸ“¦ Requirements

Python 3.6+

requests library

OpenWeatherMap API key (free)

βš™οΈ Setup Instructions

  1. Clone the repo:

    git clone https://github.com/your-username/weather-cli.git
    cd weather-cli
    
  2. Create a virtual environment (optional but recommended)

       python -m venv venv
       # Activate it:
       source venv/bin/activate       # macOS/Linux
       venv\Scripts\activate          # Windows (CMD)
       venv\Scripts\Activate.ps1      # Windows (PowerShell)
    
  3. Install dependencies

    pip install requests
    

Or from requirements.txt:

   pip install -r requirements.txt
  1. Add your API key: Get a free API key from OpenWeatherMap, then open weather.py and replace:

        API_KEY = "your_openweather_api_key"

with your actual API key (inside quotes).

πŸš€ Usage

To check the weather for any city:

   python weather.py <city name>

Examples:

    python weather.py Nairobi
    python weather.py Tokyo
    python weather.py "New York"

🌐 Web API Version

Check out the following repositoty for the web version: Weather-web-api

πŸ“ Project Structure

    weather-cli/
    β”‚
    β”œβ”€β”€ weather.py          # Main CLI script
    β”œβ”€β”€ requirements.txt    # Dependencies
    β”œβ”€β”€ .gitignore          # Git ignored files
    β”œβ”€β”€ README.md           # This file
    └── venv/               # (optional) virtual environment

πŸ™Œ Acknowledgements:

OpenWeatherMap for the weather data API

About

A simple and fun command-line tool to check the current weather for any city using the OpenWeatherMap API. Built with Python 🐍.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages