Skip to main content

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

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


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 details)

Uploaded Source

Built Distribution

requests_forecast-1.0.0-py2.py3-none-any.whl (5.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file requests-forecast-1.0.0.tar.gz.

File metadata

  • Download URL: requests-forecast-1.0.0.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for requests-forecast-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b8dbd3c244bbb54cbb3e295bed8299497ac4f6d1b6b0260971c0545b9c3f7f65
MD5 33a9219d3cbe7118eaad717c6623c8ba
BLAKE2b-256 c95f9d5e24645bdca48766e3aefa04950a458b612c2d415a9207b98d4d198e5a

See more details on using hashes here.

File details

Details for the file requests_forecast-1.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: requests_forecast-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for requests_forecast-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2e2e2dba15adb9e6f84cae006767cea8300c3e364caf9f47ccf68397dc5f2c5a
MD5 8806d5c23488f3c2b91c54001f85a73f
BLAKE2b-256 1c268e4f15daf4a58b045524441208cc33f63f7532b220c6b55897cc6548e4b6

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