mirror of
https://github.com/Adam-Ant/drone-trigger
synced 2024-09-09 00:33:53 +00:00
Allow integer indexed arrays in JSON structure
This commit is contained in:
parent
e28fed6933
commit
dbebef95b8
7
main.py
7
main.py
@ -79,9 +79,12 @@ def jsonVal(url, struct):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
for i in struct.split('.'):
|
for i in struct.split('.'):
|
||||||
dataDict = dataDict[i]
|
if i.isdigit():
|
||||||
|
dataDict = dataDict[int(i)]
|
||||||
|
else:
|
||||||
|
dataDict = dataDict[i]
|
||||||
return dataDict
|
return dataDict
|
||||||
except KeyError:
|
except:
|
||||||
print('Error: Invalid structure: ' + struct)
|
print('Error: Invalid structure: ' + struct)
|
||||||
print(dataDict)
|
print(dataDict)
|
||||||
raise
|
raise
|
||||||
|
Loading…
Reference in New Issue
Block a user