removed unused shutdown contact, renamed variable

This commit is contained in:
b3yond 2018-01-05 11:02:45 +01:00
parent 0b89a52da3
commit e962bbbe85

View file

@ -42,13 +42,6 @@ class RetweetBot(object):
keys[3]) # access_token_secret keys[3]) # access_token_secret
self.api = tweepy.API(auth) self.api = tweepy.API(auth)
# intialize shutdown contact
try:
self.no_shutdown_contact = False
self.contact = self.config['mail']['contact']
except KeyError:
self.no_shutdown_contact = True
self.historypath = historypath self.historypath = historypath
self.last_mention = self.get_history(self.historypath) self.last_mention = self.get_history(self.historypath)
self.trigger = trigger self.trigger = trigger
@ -134,14 +127,14 @@ class RetweetBot(object):
mentions = self.api.mentions_timeline(since_id=self.last_mention) mentions = self.api.mentions_timeline(since_id=self.last_mention)
return mentions return mentions
except tweepy.RateLimitError: except tweepy.RateLimitError:
message = "Twitter API Error: Rate Limit Exceeded." logmsg = "Twitter API Error: Rate Limit Exceeded."
message = message + self.logger.generate_tb(sys.exc_info()) logmsg = logmsg + self.logger.generate_tb(sys.exc_info())
self.logger.log(message) self.logger.log(logmsg)
self.waitcounter += 60*15 + 1 self.waitcounter += 60*15 + 1
except requests.exceptions.ConnectionError: except requests.exceptions.ConnectionError:
message = "Twitter API Error: Bad Connection." logmsg = "Twitter API Error: Bad Connection."
message = message + self.logger.generate_tb(sys.exc_info()) logmsg = logmsg + self.logger.generate_tb(sys.exc_info())
self.logger.log(message) self.logger.log(logmsg)
self.waitcounter += 10 self.waitcounter += 10
return None return None
@ -160,15 +153,15 @@ class RetweetBot(object):
self.last_mention = status.id self.last_mention = status.id
return self.format_mastodon(status) return self.format_mastodon(status)
except requests.exceptions.ConnectionError: except requests.exceptions.ConnectionError:
message = "Twitter API Error: Bad Connection." logmsg = "Twitter API Error: Bad Connection."
message = message + self.logger.generate_tb(sys.exc_info()) logmsg = logmsg + self.logger.generate_tb(sys.exc_info())
self.logger.log(message) self.logger.log(logmsg)
sleep(10) sleep(10)
# maybe one day we get rid of this error: # maybe one day we get rid of this error:
except tweepy.TweepError: except tweepy.TweepError:
message = "Twitter Error." logmsg = "Twitter Error."
message = message + self.logger.generate_tb(sys.exc_info()) logmsg = logmsg + self.logger.generate_tb(sys.exc_info())
self.logger.log(message) self.logger.log(logmsg)
# self.log.log("Twitter API Error: You probably already retweeted this tweet: " + status.text) # self.log.log("Twitter API Error: You probably already retweeted this tweet: " + status.text)
if status.id > self.last_mention: if status.id > self.last_mention:
self.last_mention = status.id self.last_mention = status.id
@ -187,9 +180,9 @@ class RetweetBot(object):
self.api.update_status(status=post) self.api.update_status(status=post)
return return
except requests.exceptions.ConnectionError: except requests.exceptions.ConnectionError:
message = "Twitter API Error: Bad Connection." logmsg = "Twitter API Error: Bad Connection."
message = message + self.logger.generate_tb(sys.exc_info()) logmsg = logmsg + self.logger.generate_tb(sys.exc_info())
self.logger.log(message) self.logger.log(logmsg)
sleep(10) sleep(10)
def flow(self, to_tweet=()): def flow(self, to_tweet=()):