mirror of
https://github.com/Adam-Ant/drone-trigger
synced 2024-12-20 07:24:34 +00:00
Merge pull request #1 from frebib/master
Fix some bugs, add some functionality :)
This commit is contained in:
commit
75f51fa233
6
main.py
6
main.py
@ -79,9 +79,12 @@ def jsonVal(url, struct):
|
||||
|
||||
try:
|
||||
for i in struct.split('.'):
|
||||
if i.isdigit():
|
||||
dataDict = dataDict[int(i)]
|
||||
else:
|
||||
dataDict = dataDict[i]
|
||||
return dataDict
|
||||
except KeyError:
|
||||
except:
|
||||
print('Error: Invalid structure: ' + struct)
|
||||
print(dataDict)
|
||||
raise
|
||||
@ -136,6 +139,7 @@ if __name__ == '__main__':
|
||||
try:
|
||||
curr_value = jsonVal(config[service].get('url'), config[service].get('structure'))
|
||||
except:
|
||||
print('Error: Could not get current value for ' + service)
|
||||
exit(1)
|
||||
print('Writing Initial value for ' + service + ': ' + curr_value)
|
||||
config[service]['current_value'] = curr_value
|
||||
|
Loading…
Reference in New Issue
Block a user