Skip to main content
Build Status Coverage Status Requirements Status Latest Package Version Download Status

For complete docs and API options see: https://developer.forecast.io/docs/v2

Requirements

  • Python 2.5+

  • requests 1.2.0+

Installation

To install requests-forecast, simply:

$ pip install requests-forecast

Documentation

Quickstart

Creating a client

>>> from requests_forecast import Forecast
>>> forecast = Forecast(apikey='FORECAST_API_KEY', latitude=38.9717, longitude=-95.235)

Getting the current conditions

>>> current = forecast.get_currently()
>>> print current['temperature']
58.9

Getting minutely conditions

>>> current = forecast.get_minutely()
>>> current['summary']
u'Mostly cloudy for the hour.'
>>> current['data'][0].keys()
[u'precipIntensity', u'time']

Getting hourly conditions

>>> current = forecast.get_hourly()
>>> current['temperature']
59.52


>>> forecast.get_hourly()['summary']
Mostly cloudy until tomorrow afternoon.

>>> forecast.get_hourly()['data'][0]['temperature']
>>> 59.52

Getting daily conditions

>>> forecast.get_daily()['summary']
u'Mixed precipitation off-and-on throughout the week; temperatures peaking at 70\xb0 on Sunday.'
>>> forecast.get_daily()['data'][0]['temperatureMax']
63.85
>>> forecast.get_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.get_currently()['temperature']
58.9

data = forecast.get(latitude=38.9717, longitude=-95.235,
    time=datetime(year=2013, month=12, day=29))

>>> forecast.get_currently()['temperature']
58.9

>>> forecast.get_currently()['temperature']
36.75

License

New BSD

Metadata

Release files for requests-forecast 0.6.0

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

Source distribution (sdist)

Source distribution for requests-forecast 0.6.0
File Size Uploaded
requests-forecast-0.6.0.tar.gz 24.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for requests-forecast 0.6.0
File Interpreter ABI Platform
requests_forecast-0.6.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 29.7 kB

Release files / requests-forecast-0.6.0.tar.gz

Download URL requests-forecast-0.6.0.tar.gz
Size 24.1 kB
Tags Source
SHA-256 checksum
How to use checksums
84c51ffb5c74e24374d1f4bae3934a15645822622fa885c74e89a375088157db
BLAKE2b-256 checksum
How to use checksums
857635536bc4be963d926525fa6ebde8deb103c1a36697d51b6555bfee9a888e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / requests_forecast-0.6.0-py2.py3-none-any.whl

Download URL requests_forecast-0.6.0-py2.py3-none-any.whl
Size 5.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
0bf3c6822220eb83c94c334c7f11c20c60777706a27ff3a171a39fc509c300e5
BLAKE2b-256 checksum
How to use checksums
63ad1ac75a9e5ba2f2076dd5143e6dceff09e8a1ec1f6ee7c85927ec10dd003f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.0.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.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