Weather.py 464 B

1234567891011121314151617
  1. #!/usr/bin/env python
  2. import configparser;
  3. import sys
  4. class Weather():
  5. def __init__(self, config : configparser.ConfigParser):
  6. self.Provider = None
  7. # search the required sections
  8. for key in config:
  9. if 'provider' == key:
  10. self.Provider = config['provider']
  11. if self.Provider is None:
  12. sys.stderr.write('No weather-provider configuration found!')
  13. sys.exit(-1)