-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
executable file
·29 lines (20 loc) · 706 Bytes
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Author: Behrad Toghi
## HeyMercedes Project
## https://behrad.toghi.net
## Feb 17, 2019
import json
# This function reads the configurations from a text file to be used in other modules
def getConfigs():
filename = 'CONFIGS.txt'
configs = {}
with open(filename) as fl:
for line in fl:
config, value = line.strip().split(' ', 1)
configs[config] = value.strip()
configsJSON = json.dumps(configs, indent=2, sort_keys=True)
configsDict = json.loads(configsJSON)
houndifyID = configsDict["HOUNDIFYID"]
houndifyKey = configsDict["HOUNDIFYKEY"]
nytKey = configsDict["NYTKEY"]
nytPeriod = configsDict["NYTPERIOD"]
return houndifyID, houndifyKey, nytKey, nytPeriod