Commit e91d4b2a authored by Hiro's avatar Hiro 🏄
Browse files

Fix error and call backs in twitter message responder

parent 983dbbd6
...@@ -100,7 +100,6 @@ class Sendmail(object): ...@@ -100,7 +100,6 @@ class Sendmail(object):
).addCallback(self.sendmail_callback).addErrback(self.sendmail_errback) ).addCallback(self.sendmail_callback).addErrback(self.sendmail_errback)
@defer.inlineCallbacks @defer.inlineCallbacks
def get_new(self): def get_new(self):
""" """
...@@ -178,7 +177,7 @@ class Sendmail(object): ...@@ -178,7 +177,7 @@ class Sendmail(object):
# build message # build message
link_msg = None link_msg = None
file = "" file = ""
for link in links: for link in links:
provider = link[5] provider = link[5]
version = link[4] version = link[4]
......
...@@ -80,7 +80,9 @@ class Twitterdm(object): ...@@ -80,7 +80,9 @@ class Twitterdm(object):
:return: deferred whose callback/errback will handle the API execution :return: deferred whose callback/errback will handle the API execution
details. details.
""" """
return self.send_tweet(twitter_id, message) return self.send_tweet(
twitter_id, message
).addCallback(self.twitter_callback).addErrback(self.twitter_errback)
def send_tweet(self, twitter_id, message): def send_tweet(self, twitter_id, message):
...@@ -89,9 +91,10 @@ class Twitterdm(object): ...@@ -89,9 +91,10 @@ class Twitterdm(object):
) )
if post_data.status_code == 200: if post_data.status_code == 200:
time.sleeps(30) time.sleeps(30)
self.twitter_callback
else: else:
self.twitter_errback raise RuntimeError as e:
log.info("Error sending message: {}.".format(e))
return post_data return post_data
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment