Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyOWM config as a dict #248

Closed
csparpa opened this issue Apr 16, 2018 · 0 comments
Closed

PyOWM config as a dict #248

csparpa opened this issue Apr 16, 2018 · 0 comments

Comments

@csparpa
Copy link
Owner

csparpa commented Apr 16, 2018

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 package pyowm
  • 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. Also city_id_registry shall not
    be instantiated here but by the OWM class
  • refactor the PyOWM factory system, changing the main library object from OWM25 to OWM (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)
@csparpa csparpa added this to the Release 3.0.0 milestone Apr 16, 2018
@csparpa csparpa closed this as completed May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant