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"]:
|
||||
dt = isoparse(e["timeStamp"])
|
||||
if "value" in e:
|
||||
p = e
|
||||
elif "aspects" in e:
|
||||
p = e["aspects"][index]["points"][0]
|
||||
else:
|
||||
raise()
|
||||
v = p.get("value", None)
|
||||
q = p.get("quality", None)
|
||||
a = p.get("additionalInfo", None)
|
||||
@@ -317,8 +322,10 @@ Returns the result set as string in the sip format!
|
||||
r = "!"
|
||||
sep = " "
|
||||
for e in self.result()["events"]:
|
||||
v = e["aspects"][index]["points"][0]["value"]
|
||||
q = e["aspects"][index]["points"][0]["quality"]
|
||||
if "aspects" in e:
|
||||
e = e["aspects"][index]["points"][0]
|
||||
v = e["value"]
|
||||
q = e["quality"]
|
||||
r += "%s%i/%i" % (sep, v, q)
|
||||
sep = ";"
|
||||
return(r)
|
||||
@@ -332,5 +339,20 @@ Exception class to use on http errors.
|
||||
def __init__(self, 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__":
|
||||
pass
|
||||
|
Reference in New Issue
Block a user