pyweather package

Submodules

pyweather.pyweather module

pyweather.pyweather.openweather_conditions(location, units='imperial', lang='en')[source]

Gets the current weather conditions (in JSON format) from the Open Weather Map service. For more information, see http://openweathermap.org/current.

Parameters:
  • location – a location in ‘city, state, country’ format (e.g. Salt Lake City, Utah, United States)
  • units – the desired units of measurement (imperial or metric)
  • lang – the language the data is returned with

:return The current weather conditions for the given location. None if the location is invalid.

pyweather.pyweather.yahoo_conditions(location, units='f')[source]

Gets the current weather conditions from Yahoo weather. For more information, see https://developer.yahoo.com/weather/.

Parameters:
  • location – a location in ‘city, state, country’ format (e.g. Salt Lake City, Utah, United States)
  • units – fahrenheit by default (f). You may also choose celsius by entering c instead of f.
Returns:

The current weather conditions for the given location. None if the location is invalid.

pyweather.utils module

pyweather.utils.fetch_woeid(location)[source]

Fetch a location’s corresponding WOEID.

Parameters:location – (string) a location (e.g. 23454 or Salt Lake City, United States)
Returns:a string containing the location’s corresponding WOEID or None if the WOEID could not be found.
pyweather.utils.fetch_xml(url)[source]

Fetch a url and parse the document’s XML.

Parameters:url – the URL that the XML is located at.
Returns:the root element of the XML.

Module contents