Skip to main content

Wrapper layer for https://tomorrow.io

Project description

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?

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tomorrow_io-0.0.3.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

tomorrow_io-0.0.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file tomorrow_io-0.0.3.tar.gz.

File metadata

  • Download URL: tomorrow_io-0.0.3.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for tomorrow_io-0.0.3.tar.gz
Algorithm Hash digest
SHA256 ba377736f77d359749e4b72b50497a38bed2629bae423ba02b72f8a1b2ddf4e1
MD5 4645c3f62ec0a003ae93b5cc183a47bb
BLAKE2b-256 d2c526b3ef62fe3d90fb3e5f1cd7ae81ad2d519efdeec7a27a2fd52c529d869d

See more details on using hashes here.

File details

Details for the file tomorrow_io-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: tomorrow_io-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for tomorrow_io-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 141e40ae73edbf010b032ad753f32a5350f4e6b096fc199aef1ad7dcfbac3f72
MD5 f8f830bdae47c0a2dc50492e877c3888
BLAKE2b-256 47970901be7948e2e5104fe62cce5e9d7a64f430e93356e3d80614abb828173d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page