Skip to main content

License: MIT Code style: black

Tomorrow_io

Provides a wrapper layer for interfacing with Tomorrow.io. This is not an official package, and is primarily written for use in HomeAssistant plugins.

Useage

You will need to get an API key from Tomorrow.io. Sign up, then navigate to the keys page to get your API key. Note that the free plan limits you to 500 requests/day and 25 requests/hour.

Once you have an API key, you can simply create a Tomorrow object, and start pinging the API. A few examples follow.

Examples

Defaults

By default, the package assumes you want to know about Iowa State University. You can change that by passing the longitude and latutude arguments to any of Tomorrow's functions. To set your own defaults, pass them to the __init__ call. For prettymuch everything else, it assumes you want to follow Tomorrow.io's defaults, from their API docs.

Get the current temperature

from tomorrow_io import Tomorrow

apikey = 'YOUR_API_KEY'

tomorrow = Tomorrow(apikey)
tomorrow.get_current(data_fields=['temperature'])

Set a default location

from tomorrow_io import Tomorrow

apikey = 'YOUR_API_KEY'

# Check in on the Hawkeyes, may they always have rain on gameday!
tomorrow = Tomorrow(apikey, longitude=-91.5549009294, latitude=41.6626978351)
tomorrow.get_current(data_fields=['weatherCode'])

Note that we can still override the default location by passing latitude and/or longitude any of the functions of Tomorrow.

data_fields

To get the information you want, you have to ask for it. Tomorrow.io supports numerous data fields, so I won't list them all, but some of the most common ones are below. A full list can be found here

temperature
temperatureApparent
humidity
precipitationProbability
precipitationType
cloudCover
weatherCode
epaIndex
epaHealthConcern
weedIndex
grassIndex
treeIndex

FAQ

Why bother with this though? Aren't API calls pretty easy?

Yep. The only real reason this exists is to facilitate Home Assistant plugin development. They require that API calls be wrapped in a library, available on PyPi. Source

Why black? That makes all this code look really dumb!

Yeah, I agree. Trying it out, since the Home Assistant project uses it, and I figured I should get used to it.

Pip install fails with file not foud: setup.py or similar

Your pip is out of data. pip install --upgrade pip (requires at least pip version 19, link)

This FAQ seems like a list of reasons not to use this

Yes it does, doesn't it?

Release files for tomorrow-io 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tomorrow-io 0.0.3
File Size Uploaded
tomorrow_io-0.0.3.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tomorrow-io 0.0.3
File Interpreter ABI Platform
tomorrow_io-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size:9.8 kB

Release files / tomorrow_io-0.0.3.tar.gz

Download URL tomorrow_io-0.0.3.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ba377736f77d359749e4b72b50497a38bed2629bae423ba02b72f8a1b2ddf4e1
BLAKE2b-256 checksum
How to use checksums
d2c526b3ef62fe3d90fb3e5f1cd7ae81ad2d519efdeec7a27a2fd52c529d869d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / tomorrow_io-0.0.3-py3-none-any.whl

Download URL tomorrow_io-0.0.3-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
141e40ae73edbf010b032ad753f32a5350f4e6b096fc199aef1ad7dcfbac3f72
BLAKE2b-256 checksum
How to use checksums
47970901be7948e2e5104fe62cce5e9d7a64f430e93356e3d80614abb828173d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page