diff --git a/src/Currency.py b/src/Currency.py index f06e4e4..359ed65 100644 --- a/src/Currency.py +++ b/src/Currency.py @@ -35,7 +35,13 @@ class CurrencyTask(CoindroidAPITask): continue if self.currentTransaction: self.lastTransaction = self.currentTransaction.copy() - self.currentTransaction = request.json()[0] + self.currentTransaction = request.json() + if not request.json(): + self.logger.error("Response is empty!") + elif len(request.json()) < 1: + self.logger.error("Response is empty!") + else: + self.currentTransaction = request.json()[0] self.logger.info("Retrieved currency from Coindroids...") self.logger.debug("{}".format(self.currentTransaction.get("last_ingested"))) if not self.lastTransaction: diff --git a/src/Droid.py b/src/Droid.py index afbc13a..cbdca70 100644 --- a/src/Droid.py +++ b/src/Droid.py @@ -2,7 +2,9 @@ import logging, telepot from CoindroidAPI import CoindroidAPITask from gevent import sleep from collections import namedtuple -from twilio.rest import Client as TwilioClient + + +# from twilio.rest import Client as TwilioClient class DroidControllerTask(CoindroidAPITask): @@ -21,12 +23,12 @@ class DroidControllerTask(CoindroidAPITask): "experienceChangedFrom", "experienceChangedTo", ]) - twilioAccount = "ACdfcd2b529db83954e8a0041796072960" - twilioToken = "ab9b98a0b3da8a728d14774192773af2" - try: - self.twilioClient = TwilioClient(twilioAccount, twilioToken) - except: - self.logger.exception("Unable to initialize Twilio client!") + # twilioAccount = "ACdfcd2b529db83954e8a0041796072960" + # twilioToken = "ab9b98a0b3da8a728d14774192773af2" + # try: + # self.twilioClient = TwilioClient(twilioAccount, twilioToken) + # except: + # self.logger.exception("Unable to initialize Twilio client!") try: self.telegramBot = telepot.Bot( "382491836:AAGj8Hf5HNAwcukRrjQ3Eyv7TSa2YvGax5s") @@ -132,8 +134,8 @@ class DroidControllerTask(CoindroidAPITask): stats["targetID"] == 160): self.logger.debug( "bob's got an action!!! sending sms!!") - if self.twilioClient: - self.sendSMS(to="+14088963912", body=message) + # if self.twilioClient: + # self.sendSMS(to="+14088963912", body=message) if self.telegramBot: self.telegramBot.sendMessage(-228315434, message) if (stats["droid_name"] == "Mabuhay") or ( @@ -142,8 +144,8 @@ class DroidControllerTask(CoindroidAPITask): "targetID"] == 165: self.logger.debug( "Mabuhay's got an action!!! sending sms!!") - if self.twilioClient: - self.sendSMS(to="+14086342295", body=message) + # if self.twilioClient: + # self.sendSMS(to="+14086342295", body=message) if self.telegramBot: self.telegramBot.sendMessage(-228315434, message) else: