Add more checks on getting messages

master
Mark Veidemanis 3 years ago
parent 0cd8c0b358
commit 483f893ffb
Signed by: m
GPG Key ID: 5ACFCEED46C0904F

@ -7,7 +7,7 @@ from twisted.internet.threads import deferToThread
from json import loads from json import loads
from forex_python.converter import CurrencyRates from forex_python.converter import CurrencyRates
from agoradesk_py import AgoraDesk from agoradesk_py import AgoraDesk
from httpx import ReadTimeout from httpx import ReadTimeout, ReadError
from pycoingecko import CoinGeckoAPI from pycoingecko import CoinGeckoAPI
from datetime import datetime from datetime import datetime
@ -186,7 +186,10 @@ class Agora(object):
Get recent messages. Get recent messages.
""" """
messages_tmp = {} messages_tmp = {}
try:
messages = self.agora.recent_messages() messages = self.agora.recent_messages()
except ReadError:
return False
if not messages["success"]: if not messages["success"]:
return False return False
if "data" not in messages["response"]: if "data" not in messages["response"]:
@ -487,7 +490,8 @@ class Agora(object):
# Remove extra tabs # Remove extra tabs
ad = ad.replace("\\t", "\t") ad = ad.replace("\\t", "\t")
form = {"country_code": countrycode, form = {
"country_code": countrycode,
"currency": currency, "currency": currency,
"trade_type": "ONLINE_SELL", "trade_type": "ONLINE_SELL",
"asset": asset, "asset": asset,

Loading…
Cancel
Save