浏览代码

introduce the weather configuration

Sven Czarnian 3 年之前
父节点
当前提交
3743f31b84
共有 1 个文件被更改,包括 19 次插入0 次删除
  1. 19 0
      aman/config/Weather.py

+ 19 - 0
aman/config/Weather.py

@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+import configparser;
+import sys
+
+class Weather():
+    def __init__(self, config : configparser.ConfigParser):
+        self.Provider = None
+        self.PortReceiver = None
+        self.PortNotification = None
+
+        # search the required sections
+        for key in config:
+            if 'provider' == key:
+                self.Provider = config['address']
+
+        if self.Provider is None:
+            sys.stderr.write('No weather-provider configuration found!')
+            sys.exit(-1)