Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A simple Python wrapper for the Dark Sky API
Python
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
darksky
.gitignore
README.md
requirements.txt
setup.py

README.md

Dark Sky

A small, Pythonic wrapper for the Dark Sky API.

Make sure to register for a Mapquest API key to take full advantage of the library.

Installation

pip install darksky

It's then pretty beneficial to go ahead and save your API keys as environment variables.

export DARK_SKY_API=my_dark_sky_api_key
export MAPQUEST_API_KEY=my_mapquest_api_key

Usage

import darksky as ds

# Haven't saved your API key as an environment variable?
ds.key('my_dark_sky_api_key')

# You can also save your Mapquest API key
ds.mapquest('mapquest_api_key')

# Look up interesting storms
ds.interesting()

# Get a brief forecast for a latitude/longitude
ds.brief(37.775002, -122.418297)

# Or for a given address
ds.brief('155 9th St San Francisco, CA')

# Alternatively, get the full forecast
ds.forecast(37.775002, -122.418297)

# Same goes for an address
ds.forecast('155 9th St San Francisco, CA')

# Fetch the latitude/longitude manually
ds.location('155 9th St San Francisco, CA')

Forecast

Due to the updated Dark Sky API changes, a new date method has been added.

import darksky as ds
import moment

# Let's check the weather like it's 1999
date = moment.date(1999, 12, 31).date

# Using latitude/longitude
ds.date(37.775002, -122.418297, date)

# Using the MapQuest API
ds.date('San Francisco, CA', date)
Something went wrong with that request. Please try again.