Skip to main content

Wrapper for Forecast API

Project description

Wrapper for Forecast API build on top of async/await syntaxe and aiohttp.


pip install aioforecast


from aioforecast import Forecast
client = Forecast(API_KEY)
data = await, LONGITUDE, TIME)

TCPConnector and 15s timeout are default and can be used as-is in a classic service. But this library can also be used in a constrained infrastructure, like a connected device (IOT). For this purpose, client can be tuned at instantiation time.

For example, your device needs to talk thru a proxy which may be very slow to responde:

from aioforecast import Forecast
from aiohttp import ProxyConnector
proxy = ProxyConnector(proxy="")
timeout = 60
client = Forecast(API_KEY, connector=proxy, timeout=timeout)
data = await, LONGITUDE, TIME)

The object returned is a mapping, with an additionnal headers property that expose response headers. For example:

print('temperature is %s' % data['currently']['temperature'])
if int(data.headers['X-Forecast-Api-Calls']) <= 1000:
    print('still free')

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
aioforecast-0.0.1a2-py2.py3-none-any.whl (5.4 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Jul 10, 2016
aioforecast-0.0.1a2.tar.gz (19.4 kB) Copy SHA256 hash SHA256 Source None Jul 10, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page