Skip to content

A python script designed to provide access to current weather data for a specified city.

Notifications You must be signed in to change notification settings

scriubuguri/PythonicSky

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

#meteo_data.py

A quick and simple CLI tool that gets weather data from an API. This program allows you to retrieve weather details and forecasts for a specific city using the OpenWeatherMap API. It provides information such as current temperature, wind speed, humidity, and cloudiness.

Features

  • Retrieve weather data for a city using the OpenWeatherMap API.
  • Specify the temperature units (metric, imperial, or standard).
  • Choose the weather parameter to display (temperature, wind speed, humidity, or cloudiness).
  • Supports verbose mode, which provides additional information in the output.

Requirements

  • Python 3.x
  • requests module
  • json module
  • argparse module

Installation

  1. Clone this repository

Open a terminal and change the current directory to the location where you want to clone the repository. Type the following command and press enter:

git clone https://github.com/scriubuguri/meteodata.git
  1. Sign up to OpenWeather here and get your API key.

  2. Open the meteodata.py file and add your API key on the API_KEY variable.

Usage

Run the program using the following command:

python meteo_data.py [-c <city>] [-u {metric,imperial,standard}] [-p {t,w,h,c}] [-v]

or

chmod +x meteo_data.py
./meteo_data.py [-c <city>] [-u {metric,imperial,standard}] [-p {t,w,h,c}] [-v]

The available options are:

  • -c <city>: Specify the name of the city for which you want to retrieve weather information. If not provided, the default city is "Bucharest".
  • -u <units>: Specify the temperature units to display. Available options are "metric" (Celsius), "imperial" (Fahrenheit), and "standard" (Kelvin). The default unit is "metric".
  • -p <parameter>: Specify the weather parameter to display. Available options are "t" (temperature), "w" (wind speed), "h" (humidity), and "c" (cloudiness). The default parameter is "t".
  • -v: Enable verbose mode. Additional information will be displayed in the output.

Example

  • Retrieve the current temperature for Pitesti in Celsius:
python meteo_data.py -c Pitesti -u metric -p t
  • Retrieve the wind speed for Timisoara in miles per hour with verbose mode:
python meteo_data.py -c "Timisoara" -u imperial -p w -v
  • Retrieve the humidity for Iasi:
python meteo_data.py -c Iasi -p h
  • Retrieve the cloudiness for Ploiesti:
python meteo_data.py -p c -c Ploiesti

Author

  • scriubuguri

License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.

About

A python script designed to provide access to current weather data for a specified city.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages