[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [gettor/master] Fix error and call backs in twitter message responder
commit e91d4b2a41d96ca8b7358c72043017f5ac453139
Author: hiro <hiro@xxxxxxxxxxxxxx>
Date: Wed Oct 16 12:57:09 2019 +0200
Fix error and call backs in twitter message responder
---
gettor/services/email/sendmail.py | 3 +--
gettor/services/twitter/twitterdm.py | 9 ++++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/gettor/services/email/sendmail.py b/gettor/services/email/sendmail.py
index 9976474..545fbb8 100644
--- a/gettor/services/email/sendmail.py
+++ b/gettor/services/email/sendmail.py
@@ -100,7 +100,6 @@ class Sendmail(object):
).addCallback(self.sendmail_callback).addErrback(self.sendmail_errback)
-
@defer.inlineCallbacks
def get_new(self):
"""
@@ -178,7 +177,7 @@ class Sendmail(object):
# build message
link_msg = None
file = ""
-
+
for link in links:
provider = link[5]
version = link[4]
diff --git a/gettor/services/twitter/twitterdm.py b/gettor/services/twitter/twitterdm.py
index 8965319..e67610b 100644
--- a/gettor/services/twitter/twitterdm.py
+++ b/gettor/services/twitter/twitterdm.py
@@ -80,7 +80,9 @@ class Twitterdm(object):
:return: deferred whose callback/errback will handle the API execution
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):
@@ -89,9 +91,10 @@ class Twitterdm(object):
)
if post_data.status_code == 200:
time.sleeps(30)
- self.twitter_callback
+
else:
- self.twitter_errback
+ raise RuntimeError as e:
+ log.info("Error sending message: {}.".format(e))
return post_data
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits