SimpleWeatherCLI is a simple command-line to find weather conditions in a city. It uses current and forecast data provided via API by https://openweathermap.org/. The purpose of this project is to create a simple example of a command-line interfaces using http://docopt.org/ and use Github Actions to build and upload the package to https://pypi.org/.
Project description
SimpleWeatherCLI
Description
simpleweathercli is a simple command-line to find weather conditions in a city. It uses current and forecast data provided via API by https://openweathermap.org/. The purpose of this project is to create a simple example of a command-line interfaces using http://docopt.org/ and use Github Actions to build and upload the package to https://pypi.org/.
Usage
SimpleWeatherCLI
A command line tool to know the current and forecast weather data in a location.
Usage:
simpleweathercli show [--forecast] (--api-key=APIKEY) <Location>
simpleweathercli -h | --help
simpleweathercli -v | --version
Options:
-h, --help Show this screen.
-v, --version Show version.
Command 'show' options:
--api-key=APIKEY A free & valid openweathermap API key.
--forecast Call 5 day / 3 hour forecast data.
Files
simpleweathercli/
├── LICENSE
├── MANIFEST.in
├── README.md
├── setup.py
└── simpleweathercli
├── __init__.py
└── cli.py
Installation
Via PIP in your Python environment.
pip install simpleweathercli
API Key
You need an API Key from https://openweathermap.org/. In order to obtain an API Key you have to create an account, log in, go to https://home.openweathermap.org/api_keys and create an API Key. It's completely free and good enough for the purposes of this CLI.
Examples
Note that these examples use a sample API key that is already disabled.
This first example will show the current data in a city.
simpleweathercli show --api-key=bb7dbc8217979c2c4f31eb0f9f1ceb94 Madrid
{
"base": "stations",
"clouds": {
"all": 0
},
"cod": 200,
"coord": {
"lat": 40.4165,
"lon": -3.7026
},
"dt": 1617183561,
"id": 3117735,
"main": {
"feels_like": 11.09,
"humidity": 36,
"pressure": 1023,
"temp": 14.57,
"temp_max": 16.67,
"temp_min": 12
},
"name": "Madrid",
"sys": {
"country": "ES",
"id": 6443,
"sunrise": 1617170396,
"sunset": 1617215859,
"type": 1
},
"timezone": 7200,
"visibility": 10000,
"weather": [
{
"description": "clear sky",
"icon": "01d",
"id": 800,
"main": "Clear"
}
],
"wind": {
"deg": 50,
"speed": 2.06
}
}
This is an example with the forecast flag active. It will display weather forecast for 5 days with data every 3 hours by city name.
simpleweathercli show --forecast --api-key=90d91e149438f9d0a4f063dc5189720e London
{
"city": {
"coord": {
"lat": 51.5085,
"lon": -0.1257
},
"country": "GB",
"id": 2643743,
"name": "London",
"population": 1000000,
"sunrise": 1617169064,
"sunset": 1617215474,
"timezone": 3600
},
"cnt": 40,
"cod": "200",
"list": [
{
"clouds": {
"all": 44
},
"dt": 1617192000,
"dt_txt": "2021-03-31 12:00:00",
"main": {
"feels_like": 17.35,
"grnd_level": 1017,
"humidity": 52,
"pressure": 1021,
"sea_level": 1021,
"temp": 19.48,
"temp_kf": -1.36,
"temp_max": 20.84,
"temp_min": 19.48
},
"pop": 0,
"sys": {
"pod": "d"
},
"visibility": 10000,
"weather": [
{
"description": "scattered clouds",
"icon": "03d",
"id": 802,
"main": "Clouds"
}
],
"wind": {
"deg": 206,
"speed": 2.86
}
},
...
{
"clouds": {
"all": 100
},
"dt": 1617613200,
"dt_txt": "2021-04-05 09:00:00",
"main": {
"feels_like": -1.29,
"grnd_level": 998,
"humidity": 78,
"pressure": 1001,
"sea_level": 1001,
"temp": 3.68,
"temp_kf": 0,
"temp_max": 3.68,
"temp_min": 3.68
},
"pop": 1,
"snow": {
"3h": 1.14
},
"sys": {
"pod": "d"
},
"visibility": 3550,
"weather": [
{
"description": "light snow",
"icon": "13d",
"id": 600,
"main": "Snow"
}
],
"wind": {
"deg": 320,
"speed": 4.3
}
}
],
"message": 0
}
Changelog
SimpleWeatherCLI Releases:
0.1.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simpleweathercli-0.1.3.tar.gz.
File metadata
- Download URL: simpleweathercli-0.1.3.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0afa5b7dedad5c89b53264c99b174ea0dde41228a8cac72bce468abb089718b4
|
|
| MD5 |
b516079b6af0540cf53a1d612b0f7664
|
|
| BLAKE2b-256 |
a5260f4c44105a474bd7d8ce1262d1f4214b5595e970e9bac72a2ebda7576cfc
|
File details
Details for the file simpleweathercli-0.1.3-py3-none-any.whl.
File metadata
- Download URL: simpleweathercli-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
502d611c9db28455b8861642bae2bc999f4f70b39364e86b3832c6640b37f735
|
|
| MD5 |
0e1a2557d00d9a2f29f7449cb797bf5f
|
|
| BLAKE2b-256 |
a68cd27ebc615289d64ccc82d32c2f5159ab9de59f130e2bc47b5df6dc87b188
|