Fix verwijderen array
This commit is contained in:
26
ddapioper.py
26
ddapioper.py
@@ -270,7 +270,12 @@ Note:
|
|||||||
"""
|
"""
|
||||||
for e in self.result()["events"]:
|
for e in self.result()["events"]:
|
||||||
dt = isoparse(e["timeStamp"])
|
dt = isoparse(e["timeStamp"])
|
||||||
|
if "value" in e:
|
||||||
|
p = e
|
||||||
|
elif "aspects" in e:
|
||||||
p = e["aspects"][index]["points"][0]
|
p = e["aspects"][index]["points"][0]
|
||||||
|
else:
|
||||||
|
raise()
|
||||||
v = p.get("value", None)
|
v = p.get("value", None)
|
||||||
q = p.get("quality", None)
|
q = p.get("quality", None)
|
||||||
a = p.get("additionalInfo", None)
|
a = p.get("additionalInfo", None)
|
||||||
@@ -317,8 +322,10 @@ Returns the result set as string in the sip format!
|
|||||||
r = "!"
|
r = "!"
|
||||||
sep = " "
|
sep = " "
|
||||||
for e in self.result()["events"]:
|
for e in self.result()["events"]:
|
||||||
v = e["aspects"][index]["points"][0]["value"]
|
if "aspects" in e:
|
||||||
q = e["aspects"][index]["points"][0]["quality"]
|
e = e["aspects"][index]["points"][0]
|
||||||
|
v = e["value"]
|
||||||
|
q = e["quality"]
|
||||||
r += "%s%i/%i" % (sep, v, q)
|
r += "%s%i/%i" % (sep, v, q)
|
||||||
sep = ";"
|
sep = ";"
|
||||||
return(r)
|
return(r)
|
||||||
@@ -332,5 +339,20 @@ Exception class to use on http errors.
|
|||||||
def __init__(self, code):
|
def __init__(self, code):
|
||||||
self.code = code
|
self.code = code
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return("Code: %s" % self.code)
|
||||||
|
|
||||||
|
class ddApiOperJsonError(Exception):
|
||||||
|
"""
|
||||||
|
Class ddApiOperJsonError
|
||||||
|
|
||||||
|
Exception class to use on json errors.
|
||||||
|
"""
|
||||||
|
def __init__(self, json):
|
||||||
|
self.json = json
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return("Parse error in: %s" % self.json)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
pass
|
pass
|
||||||
|
Reference in New Issue
Block a user