A minimalist Forecast.io API client.
Project description
requests-forecast
For complete docs and API options see: https://developer.forecast.io/docs/v2
Requirements
- Python 3.6+
- requests
Installation
To install requests-forecast, simply:
$ pip install requests-forecast
Documentation
- Development version: http://requests-forecast.rtfd.org.
Quickstart
Creating a client
from requests_forecast import Forecast forecast = Forecast(apikey='YOUR-API-KEY')
Getting the current conditions
current = forecast.currently() print current['temperature'] 58.9
Getting minutely conditions
current = forecast.minutely() current['summary'] u'Mostly cloudy for the hour.' current['data'][0].keys() [u'precipIntensity', u'time']
Getting hourly conditions
current = forecast.hourly() current['temperature'] 59.52 forecast.hourly()['summary'] Mostly cloudy until tomorrow afternoon. forecast.hourly()['data'][0]['temperature'] 59.52
Getting daily conditions
forecast.daily()['summary'] u'Mixed precipitation off-and-on throughout the week; temperatures peaking at 70\xb0 on Sunday.' forecast.daily()['data'][0]['temperatureMax'] 63.85 forecast.daily()['data'][0]['temperatureMin'] 35.05
Getting alerts
forecast.alerts() { "expires": 1366898400, "uri": "http://alerts.weather.gov/cap/wwacapget.php?x=KS124EFAC89CD0.FreezeWarning.124EFAD6F320KS.TOPNPWTOP.8ab7d76a4db42b9136a1a6849a631097", "title": "Freeze Warning for Douglas, KS" }
Example usage
from datetime import datetime from requests_forecast import Forecast forecast = Forecast(apikey='YOUR-API-KEY') data = forecast.get(latitude=38.9717, longitude=-95.235) forecast.currently()['temperature'] 58.9 data = forecast.get(latitude=38.9717, longitude=-95.235, time=datetime(year=2013, month=12, day=29)) forecast.currently()['temperature'] 58.9 forecast.currently()['temperature'] 36.75
License
New BSD
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
requests-forecast-1.0.0.tar.gz
(20.1 kB
view hashes)
Built Distribution
Close
Hashes for requests_forecast-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e2e2dba15adb9e6f84cae006767cea8300c3e364caf9f47ccf68397dc5f2c5a |
|
MD5 | 8806d5c23488f3c2b91c54001f85a73f |
|
BLAKE2-256 | 1c268e4f15daf4a58b045524441208cc33f63f7532b220c6b55897cc6548e4b6 |