Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Wrapper for Forecast API

Project Description

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

Installation:

pip install aioforecast

Usage:

from aioforecast import Forecast
client = Forecast(API_KEY)
data = await client.call(LATITUDE, 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="http://some.proxy.com")
timeout = 60
client = Forecast(API_KEY, connector=proxy, timeout=timeout)
data = await client.call(LATITUDE, 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')
Release History

Release History

This version
History Node

0.0.1a2

History Node

0.0.1a1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
aioforecast-0.0.1a2-py2.py3-none-any.whl (5.4 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Jul 10, 2016
aioforecast-0.0.1a2.tar.gz (19.4 kB) Copy SHA256 Checksum SHA256 Source Jul 10, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting