From b174db3cfeed2a07222d8efe3dd1c3ff4af60338 Mon Sep 17 00:00:00 2001 From: b3yond Date: Thu, 18 Jan 2018 13:54:32 +0100 Subject: [PATCH] twitterbot.crawl() returns reports now, not statuses --- retweetbot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/retweetbot.py b/retweetbot.py index 8dd3e10..9b0e731 100755 --- a/retweetbot.py +++ b/retweetbot.py @@ -5,6 +5,7 @@ import requests import pytoml as toml import trigger from time import sleep +import report import logging import sendmail @@ -100,15 +101,18 @@ class RetweetBot(object): """ crawls all Tweets which mention the bot from the twitter rest API. - :return: list of Status objects + :return: reports: (list of report.Report objects) """ + reports = [] try: if not self.waiting(): if self.last_mention == 0: mentions = self.api.mentions_timeline() else: mentions = self.api.mentions_timeline(since_id=self.last_mention) - return mentions + for status in mentions: + reports.append(report.Report(status.author, "twitter", status.text, status.id, status.created_at)) + return reports except tweepy.RateLimitError: logger.error("Twitter API Error: Rate Limit Exceeded", exc_info=True) self.waitcounter += 60*15 + 1