From 35cf84998ee46bd4d72fbaefd300775c630c19f0 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Wed, 26 Jan 2022 19:46:23 +0000 Subject: [PATCH] Add extra checks around APIs --- handler/agora.py | 2 ++ handler/transactions.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/handler/agora.py b/handler/agora.py index 44e04ae..1fc2bd7 100644 --- a/handler/agora.py +++ b/handler/agora.py @@ -345,6 +345,8 @@ class Agora(object): public_ads = public_ad_dict_btc[currency.lower()] except KeyError: continue + if not public_ads: + continue if xmr: if asset == "XMR": new_margin = self.autoprice(public_ads, currency) diff --git a/handler/transactions.py b/handler/transactions.py index 421a1c5..2e8c2d7 100644 --- a/handler/transactions.py +++ b/handler/transactions.py @@ -46,7 +46,11 @@ class Transactions(object): inside = data["data"] txid = inside["id"] - txtype = inside["type"] + try: + txtype = inside["type"] + except KeyError: + self.log.error("Typeless event: {id}", id=txid) + return if txtype == "card_payment": self.log.info("Ignoring card payment: {id}", id=txid) return