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).
π¦ 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'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.