Wunderground

Wunderground

A basic wrapper for the Weather Underground API.

Currently only supports the Stratus Plan Endpoints. With a Stratus Developer key, you get up to 10 API calls per minute and/or 500 calls per day (which is roughly one call every three minutes).

Build StatusCoverallsInline docsVersionLicense

πŸ“¦ Installation

Add wunderground to your list of dependencies in mix.exs:

def deps do
  [
    # ...
    {:wunderground, "~> 0.0.9"}
  ]
end

πŸ”§ Configuration

First go to wunderground.com/weather/api and sign up/in to get your API key.

The prefered way is to add an environment variable:

export WUNDERGROUND_API_KEY="<<YOUR KEY HERE>>"

And then load it in your config.exs (or env specific configuration file) like so:

config :wunderground, api_key: System.get_env("WUNDERGROUND_API_KEY")

Usage

πŸ—“ Almanac

query = {:us_zip, 11204}
{:ok, almanac} = Wunderground.almanac(query)

πŸŒ– Astronomy

query = {:airport, "LEBL"}
{:ok, astronomy} = Wunderground.astronomy(query)

🌀 Current Conditions

query = {:us, "CA", "San_Francisco"}
{:ok, conditions} = Wunderground.conditions(query)

πŸ“… Forecast

query = {:pws, "KCASANFR70"}
{:ok, forecast} = Wunderground.forecast(query)

πŸ—Ί Geolookup

query = {:international, "Germany", "Berlin"}
{:ok, geolookup} = Wunderground.geolookup(query)

Different Queries

πŸ‡ΊπŸ‡Έ Cities in the U.S.

# using state and city
{:us, "CA", "San_Francisco"}

# or via zipcode
{:us_zip, 60290}

🌍 Cities outside the U.S.

# by country and city
{:international, "Australia", "Sydney"}

🌐 Coordinates

# by latidute and longitude
{:geo, 37.8, -122.4}

✈️ Airports

# by International Civil Aviation Organization airport code
# see https://en.wikipedia.org/wiki/International_Civil_Aviation_Organization_airport_code
{:airport, "KJFK"}

🌑 Specific personal weather station

# by it&#39;s ID
{:pws, "KCASANFR70"}

πŸ“ GeoIP location

# of the running machine using
{:auto_ip}

# or of a specific IP address
{:auto_ip, {185, 1, 74, 1}}

πŸ”Ž Autocomplete

# autocomplete suggestions for the given search query
{:ok, autocomplete} = Wunderground.autocomplete("San Fra")

also supports options, see Autocomplete.options for details

# search only in Germany
{:ok, autocomplete} = Wunderground.autocomplete("Fra", [{:country, "DE"}])

Weather Underground is a registered trademark of The Weather Channel, LLC. both in the United States and internationally. The Weather Underground Logo is a trademark of Weather Underground, LLC.