pyowm package

Subpackages

Submodules

pyowm.constants module

Constants for the PyOWM library

Module contents

The PyOWM init file

Author: Claudio Sparpaglione, @csparpa <csparpa@gmail.com>

Platform: platform independent

pyowm.OWM(API_key='b1b15e88fa797225412429c1c50c122a', version='2.5', config_module=None, language=None, subscription_type=None, use_ssl=None)[source]

A parametrized factory method returning a global OWM instance that represents the desired OWM Weather API version (or the currently supported one if no version number is specified)

Parameters:
  • API_key (str) – the OWM Weather API key (defaults to a test value)
  • version (str) – the OWM Weather API version. Defaults to None, which means use the latest web API version
  • config_module (str (eg: 'mypackage.mysubpackage.myconfigmodule')) – the Python path of the configuration module you want to provide for instantiating the library. Defaults to None, which means use the default configuration values for the web API version support you are currently requesting. Please be aware that malformed user-defined configuration modules can lead to unwanted behaviour!
  • language (str) – the language in which you want text results to be returned. It’s a two-characters string, eg: “en”, “ru”, “it”. Defaults to: None, which means use the default language.
  • subscription_type (str) – the type of OWM Weather API subscription to be wrapped. Can be ‘free’ (free subscription) or ‘pro’ (paid subscription), Defaults to: ‘free’
  • use_ssl (bool) – whether API calls should be made via SSL or not. Defaults to: False
Returns:

an instance of a proper OWM subclass

Raises:

ValueError when unsupported OWM API versions are provided