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
Close
Hashes for openweathermap-simplified-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c3d2cbc715d193eacc701463f2325d20ff6b769db9d3f6e92aafce9cf783a9f |
|
MD5 | 34e2dbaa31146b6d9949188b4dae92f3 |
|
BLAKE2b-256 | 62201d07de879f0305f1d50dd3ed8fe4056a3a3802f1dee0226137e6b083674a |
Close
Hashes for openweathermap_simplified-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 985e9c4c3f9aa0ae4532d7dcf60a3297c07a612c07e3f2998f648a43cb4adf8b |
|
MD5 | 13aafcc433376b14f495b0ad305c8d32 |
|
BLAKE2b-256 | 197b3594afa7229f4db2135c9cd0ca2d2c70f0515bd6ea07da1e5a0d6653fc39 |