A simple, opinionated wrapper for the openweathermap.org API
Project description
Basic Openweathermap API wrapper
Why
This is an extremely simple wrapper around the Openweathermap OneCall API. It currently only supports forecasts. As it is designed to be simple to use at the expense of features, the data is flattened from the nested structure to a single dictionary for each forecast. In the process some data points are dropped.
Users that are interested in the complete set of data points are encouraged to open an issue or submit a pull request.
Setup
- Obtain an Openweathermap API key at openweathermap.org
- Save the api key in a file '.api.txt' or the environment variable 'OPENWEATHERMAP_API_KEY'
Usage
from openweathermap import get_daily_forecast, APIError
try:
forecast = get_daily_forecast(49.24966, -123.11934) # Vancouver, BC, Canada
except APIError as e:
# Deal with missing/incorrect API key or failed requests
print(e)
Example return value for one day:
{
"dt": "2021-10-29T13:00:00",
"sunrise": "2021-10-29T08:56:00",
"sunset": "2021-10-29T18:56:09",
"clouds": 28,
"snow": None,
"rain": None,
"pop": 0.26,
"wind_speed": 5.32,
"wind_deg": 283,
"wind_gust": 7.76,
"humidity": 72,
"temp_day": 282.15,
"temp_morn": 281.22,
"temp_eve": 280.99
}
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
File details
Details for the file openweathermap-simplified-0.0.1.tar.gz
.
File metadata
- Download URL: openweathermap-simplified-0.0.1.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c3d2cbc715d193eacc701463f2325d20ff6b769db9d3f6e92aafce9cf783a9f |
|
MD5 | 34e2dbaa31146b6d9949188b4dae92f3 |
|
BLAKE2b-256 | 62201d07de879f0305f1d50dd3ed8fe4056a3a3802f1dee0226137e6b083674a |
File details
Details for the file openweathermap_simplified-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: openweathermap_simplified-0.0.1-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 985e9c4c3f9aa0ae4532d7dcf60a3297c07a612c07e3f2998f648a43cb4adf8b |
|
MD5 | 13aafcc433376b14f495b0ad305c8d32 |
|
BLAKE2b-256 | 197b3594afa7229f4db2135c9cd0ca2d2c70f0515bd6ea07da1e5a0d6653fc39 |