#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.
- 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.
- Python 3.x
requests
modulejson
moduleargparse
module
- 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
-
Sign up to OpenWeather here and get your API key.
-
Open the
meteodata.py
file and add your API key on the API_KEY variable.
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.
- 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
- scriubuguri
This project is licensed under the GPL-3.0 License - see the LICENSE file for details.