Module containing an abstract base class for JSON OWM web API responses parsing
A global abstract class representing a JSON to object parser.
Returns a proper object parsed from the input JSON_string. Subclasses know from their specific type which object is to be parsed and returned
Parameters: JSON_string (str) – a JSON text string Returns: an object Raises: ParseResponseError if it is impossible to find or parse the data needed to build the resulting object
Module containing the abstract PyOWM library main entry point interface
A global abstract class representing the OWM web API. Every query to the API is done programmatically via a concrete instance of this class. Subclasses should provide a method for every OWM web API endpoint.
Returns the OWM API key
Returns: the OWM API key string
Returns the currently supported OWM web API version
Returns: the OWM web API version string
Returns the current version of the PyOWM library
Returns: the current PyOWM library version string
Trueif the OWM web API is currently online. A short timeout is used to determine API service availability.
Updates the OWM API key
Parameters: API_key (str) – the new value for the OWM API key
Module containing the abstract PyOWM cache provider
A global abstract class representing a caching provider which can be used to lookup the JSON responses to the most recently or most frequently issued OWM web API requests. The purpose of the caching mechanism is to avoid OWM web API requests and therefore network traffic: the implementations should be adapted to the time/memory requirements of the OWM data clients (i.e: a “slimmer” cache with lower lookup times but higher miss rates or a “fatter” cache with higher memory consumption and higher hit rates?). Subclasses should implement a proper caching algorithms bearing in mind that different weather data types may have different change rates: in example, observed weather can change very frequently while long-period weather forecasts change less frequently. External caching mechanisms (eg: memcached, redis, etc..) can be used by extending this class into a proper decorator for the correspondent Python bindings.
In case of a hit, returns the JSON string which represents the OWM web API response to the request being identified by a specific string URL.
Parameters: request_url (str) – an URL that uniquely identifies the request whose response is to be looked up Returns: a JSON str in case of cache hit or
Adds the specified response_json value to the cache using as a lookup key the request_url of the request that generated the value.
- request_url (str) – the request URL
- response_json (str) – the response JSON