Skip to content

Commit

Permalink
fixed bug with APIs new data format. fixed bug with empty data. forma…
Browse files Browse the repository at this point in the history
…tting fixes.
  • Loading branch information
ntelfer committed Oct 15, 2018
1 parent 0a97da2 commit 555cd98
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/didery/static/transcrypt/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# ================================================== #

__pragma__("kwargs")


def request(path, **kwargs):
"""
Performs a mithril GET request.
Expand All @@ -39,6 +41,7 @@ def request(path, **kwargs):

# ================================================== #


def onlyOne(func, interval=1000):
"""
Enforces the promise function. Never called more than once
Expand Down Expand Up @@ -70,6 +73,7 @@ def f(resolve, reject):
# CLASS DEFINITIONS #
# ================================================== #


def clearArray(a):
"""
Clears an array/list.
Expand All @@ -82,6 +86,7 @@ def clearArray(a):

# ================================================== #


class Manager:
"""
Class for managing server calls.
Expand All @@ -97,6 +102,7 @@ def __init__(self):

# ================================================== #


class Errors:
"""
Class for error server call.
Expand Down Expand Up @@ -144,12 +150,13 @@ def _parseAll(self, data):
}]
}
"""

for error in data['data']:
self.errors.append(error)
if 'data' in data:
for error in data['data']:
self.errors.append(error)

# ================================================== #


class History:
"""
Class for history server call.
Expand Down Expand Up @@ -226,12 +233,13 @@ def _parseAll(self, data):
}
"""

for history in data['data']:
self.history.append(JSON.parse(history))
if 'data' in data:
for key, history in data['data'].items():
self.history.append(JSON.parse(history))

# ================================================== #


class OTPBlobs:
"""
Class for otp blob server call.
Expand Down Expand Up @@ -279,11 +287,13 @@ def _parseAll(self, data):
}
"""

for blob in data['data']:
self.blobs.append(JSON.parse(blob))
if 'data' in data:
for blob in data['data']:
self.blobs.append(JSON.parse(blob))

# ================================================== #


class Relays:
"""
Class for relays server call.
Expand Down

0 comments on commit 555cd98

Please sign in to comment.