Skip to main content

Wrapper for Weather Underground API

Project description

Whether you’re already a user and want a refresher on the documentation or you’re evaluating the package for the first time, you’ve come to the right place. So what do you want to learn more about?


WunderWeather attempts to expose data supplied by Weather Underground in a way that is easy to use and easy to get weather data into your application quickly without having to deal with all of the details.

About the Wunderground API

The Wunderground API supplies different endpoints called data features which, when supplied the proper arguments, return numerous data points describing the feature being queried.


About the WunderWeather API

WunderWeather was built to expose the data supplied by Wunderground in a uniform fashion. For certain data features where it applied, wrapper classes were created to normalize the data returned and supply ease of access to that data.

When developing WunderWeather there were a few key concepts kept in mind which are listed below. If you intend on contributing, please keep these ideas in mind.
  1. Out of the hundreds of data points that Wunderground so graciously supplies, expose shortcuts to the more frequently used/popular data points such as temperature and date through the data feature specific wrappers.
    1. For the history data feature, Wunderground exposes the average temperature data point using 3 keys rather than the one abstracted in WunderWeather


    >>> response["history"]["daily_summary"]["meantempi"]


    >>> response.temp_f
  2. Normalize the data point names being exposed.
    1. The Wunderground API does a great job at supplying endless amounts of weather data but unfortunately similar data points across different features have different names. A case where this crops up frequently is for imperial (i) and metric (m) and their respective Fahrenheit (f) and Celsius (c) identifiers for temperature.

    Example Data Points:

    • temp_i vs temp_f
    • temp_m vs temp_c


pip install WunderWeather

Code Examples

The following code snippets are examples of extracting data from data feature responses. Some examples build off of previous examples (as to avoid repetition) but should be properly documented as continuation from NNN example.


The WunderWeather package is only Python 3 compatible.


Because the requests package is awesome, we’re going to be using that to make our requests in the following examples. We use it to make requests in our package and so should you!

Weather Underground Example

Not using Requests

Example listed in Wunderground documentation

import urllib2
import json
f = urllib2.urlopen('<YOUR_API_KEY>/geolookup/conditions/q/IA/Cedar_Rapids.json')
json_string =
parsed_json = json.loads(json_string)
location = parsed_json['location']['city']
temp_f = parsed_json['current_observation']['temp_f']
print "Current temperature in %s is: %s" % (location, temp_f)


Using Requests

Example listed in Wunderground doc converted to use requests

import requests # learn more:
response = requests.get('<YOUR_API_KEY>/geolookup/conditions/q/MA/Boston.json').json()
location = response['location']['city']
temp_f = response['current_observation']['temp_f']
print("Current Temperature in %s is: %s" %(location,temp_f))

Using WunderWeather

Example listed in Wunderground doc converted to use WunderWeather

from wunder import weather
extractor = weather.Extract(api_key)
[location,current] = extractor.features("MA/Boston",(('geolookup',''),('now','')))
print("Current Temperature in %s is: %s" %(,current.temp_f))

In the example above, notice how data points can be extracted from a feature using dotted notation whether there is a feature specific wrapper class or not to provide a uniform look in the calling application. When referencing shortcuts from wrapper classes or directly accessing the data, the look is the same. As of writing this documentation Geolookup does not have a wrapper so all data extracted from that feature must use the member to use the dotted notation.

Additional Examples

From pprint import pprint
import arrow
From WunderWeather import weather

# setup
api_key = "your api key"
location = 'MA/Boston'
extractor = weather.Extract(api_key)

# alerts
response = extractor.alerts(location)

# astronomy
response = extractor.astronomy(location)

# geolookup
response = extractor.geolookup(location)

# history
date = arrow.get("20170601","YYYYMMDD")
response =,date.format('YYYYMMDD'))

# addl date detail
for observation in response.observations:


Thanks for checking out this section and showing interest in making this package better. The following are points of interest that could use polishing or expanding. As always, if you see data points across data features that could use a level of abstraction just add a wrapper class if not already defined and add a property member to that class to provide a shortcut or normalized external name across features.


  1. Several Data Features only exist using the generic WeatherBase, base class and thus their data is accessed using the data member. There are likely reasons to create wrappers for these features. current hurricane seemed to need a wrapper the most. But some others that might benefit from abstraction are listed below.
    1. currenthurricane
    2. rawtide and tide
    3. hourly* based features
  2. And of course, help with documentation, documentation, and more documentation.


I just want give mention and thanks to the following:

  1. Weather Underground for supplying the data.

  2. requests for making http for me.

  3. EasyDict for supplying the dotted dictionary notation functionality.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for WunderWeather, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size WunderWeather-1.1.0.tar.gz (29.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page