A thin Python wrapper for the weather API

View on GitHub

This is a wrapper for the API. It allows you to get the weather for any location, now, in the past, or future.

The Basic Use section covers enough to get you going. I suggest also reading the source if you want to know more about how to use the wrapper or what its doing (it’s very simple).


You should use pip to install python-forecastio.



You will need an API key. You can get one by regestering as a developer at Don’t worry, a key is free.

Basic Use

Although you don’t need to know anything about the API to use this module, their docs are available at

To use the wrapper:

          import forecastio
    api_key = "YOUR API KEY"
    lat = -31.967819
    lng = 115.87718
    forecast = forecastio.load_forecast(api_key, lat, lng)

The load_forecast() method has a few optional parameters. Providing your API key, a latitude and longitude are the only required parameters.

Use the forecast.DataBlockType() eg. currently(), daily(), hourly(), minutely() methods to load the data you are after.

These methods return a DataBlock. Except currently() which returns a DataPoint.

          byHour = forecast.hourly()
    print byHour.summary
    print byHour.icon

The .data attributes for each DataBlock is a list of DataPoint objects. This is where all the best data is :)

          for hourlyData in
    print hourlyData.temperature


function forecastio.load_forecast(key, latitude, longitude)

This makes an API request and returns a Forecast object (see below).


function forecastio.manual(url)

This function allows manual creation of the URL for the API request. This method won't be required often but can be used to take advantage of new or beta features of the API which this wrapper does not support yet.

Returns a Forecast object (see below).


class forecastio.models.Forecast

The Forecast object, it contains both weather data and the HTTP response from



class forecastio.models.ForecastioDataBlock

Contains data about a forecast over time.

Attributes (descriptions taken from the website)

class forecastio.models.ForecastioDataPoint

Contains data about a forecast at a particular time.

Data points have many attributes, but not all of them are always available. Some commonly used ones are:

Attributes (descriptions taken from the website)

For a full list of ForecastioDataPoint attributes and attribute descriptions, take a look at the data point documentation (