Additional error handling
This commit is contained in:
parent
f28e42c42f
commit
3340b6d4da
|
@ -49,6 +49,9 @@ class Agora(object):
|
|||
"""
|
||||
dash = self.agora.dashboard_seller()
|
||||
dash_tmp = []
|
||||
if "data" not in dash["response"].keys():
|
||||
self.log.error("Data not in dashboard response: {content}", content=dash)
|
||||
return False
|
||||
if dash["response"]["data"]["contact_count"] > 0:
|
||||
for contact in dash["response"]["data"]["contact_list"]:
|
||||
contact_id = contact["data"]["contact_id"]
|
||||
|
@ -69,7 +72,6 @@ class Agora(object):
|
|||
return False
|
||||
if dash["response"]["data"]["contact_count"] > 0:
|
||||
for contact in dash["response"]["data"]["contact_list"]:
|
||||
print(f"CONTACT {contact}")
|
||||
contact_id = contact["data"]["contact_id"]
|
||||
current_trades.append(contact_id)
|
||||
buyer = contact["data"]["buyer"]["username"]
|
||||
|
@ -101,6 +103,7 @@ class Agora(object):
|
|||
dash = self.agora.dashboard_seller()
|
||||
dash_tmp = []
|
||||
if "data" not in dash["response"]:
|
||||
self.log.error("Data not in dashboard response: {content}", content=dash)
|
||||
return False
|
||||
if dash["response"]["data"]["contact_count"] > 0:
|
||||
for contact in dash["response"]["data"]["contact_list"]:
|
||||
|
@ -147,6 +150,8 @@ class Agora(object):
|
|||
:rtype: dict with lists
|
||||
"""
|
||||
dash = self.dashboard_id_only()
|
||||
if dash is None:
|
||||
return False
|
||||
messages_tmp = {}
|
||||
for contact_id in dash:
|
||||
messages = self.get_messages(contact_id, send_irc=send_irc)
|
||||
|
|
|
@ -184,6 +184,7 @@ class Revolut(object):
|
|||
if r.status_code == 200:
|
||||
return r.json()
|
||||
else:
|
||||
self.log.error("Error getting accounts: {content}", content=r.content)
|
||||
return False
|
||||
|
||||
def get_total_usd(self):
|
||||
|
|
|
@ -52,11 +52,17 @@ class Transactions(object):
|
|||
txid = inside["id"]
|
||||
txtype = inside["type"]
|
||||
state = inside["state"]
|
||||
reference = inside["reference"]
|
||||
if "reference" in inside:
|
||||
reference = inside["reference"]
|
||||
else:
|
||||
reference = "not_given"
|
||||
|
||||
leg = inside["legs"][0]
|
||||
|
||||
account_type = leg["counterparty"]["account_type"]
|
||||
if "counterparty" in leg:
|
||||
account_type = leg["counterparty"]["account_type"]
|
||||
else:
|
||||
account_type = "not_given"
|
||||
|
||||
amount = leg["amount"]
|
||||
currency = leg["currency"]
|
||||
|
|
Loading…
Reference in New Issue