-
Notifications
You must be signed in to change notification settings - Fork 174
Closed
Labels
Milestone
Description
New interface for injecting config into the main PyOWM entry point.
Requirements
The config dict can be provided either:
- as an external file
- as a Python dict
The config file are JSON based
Each OWM API (weather API, pollution API, etc..) has its own configuration
section in the global config dict
TODOs
- place a default config file into the rooot PyOWM folder. This will collect
info from modules:pyowm.constants
,pyowm.webapi25.configuration25
,
pyowm.webapi25.owm25.OWM25
and from the entry point of packagepyowm
- implement config dict reading/writing from/to file
- take the actual
pyowm.webapi25.configuration25.weather_code_registry
data structure out
from configuration and put it into a specific module. Alsocity_id_registry
shall not
be instantiated here but by theOWM
class - refactor the PyOWM factory system, changing the main library object from
OWM25
toOWM
(more generic) - create a documentation page about config
- have
setup.py
take the info it needs from the default config file
This is the logic format for the config dict:
GLOBAL
- default language
- default API subscription type
CONNECTION
- use ssl (boolean)
- verify SSL certs (boolean)
- default connection timeout
CITY ID REGISTRY
- pattern of city ID files (es. 'cityids/%03d-%03d.txt.gz')
Example of config load
Something like:
from pyowm import OWM, load_config_from
config_dict = load_config_from('/path/to/config.py')
owm = OWM('your-api-key', config_dict)