Пример #1
0
 def test_connect(self):
     r = twitter.search("corgis")
     first = r[0]._to_dict()
     self.assertTrue(first)
Пример #2
0
            if not r.url.startswith("http://chroniclingamerica.loc.gov"):
                return False
        except:
            # if we couldn't fetch the URL we don't want to tweet it anyway
            return False
    return True


touchfile = "last_retweet"

if os.path.isfile(touchfile):
    last = datetime.datetime.fromtimestamp(os.stat(touchfile).st_mtime)
else:
    last = None

tweets = twitter.search("chroniclingamerica", count=100)
tweets.reverse()

new_last = None
for tweet in tweets:
    new_last = tweet.created_at
    if hasattr(tweet, "retweeted_status"):
        continue
    if tweet.user.screen_name == "paperbot":
        continue
    if hasattr(tweet, "possibly_sensitive") and tweet.possibly_sensitive:
        continue
    if tweet.user.screen_name in config.block:
        continue
    if last and tweet.created_at <= last:
        continue
Пример #3
0
 def test_connect(self):
     r = twitter.search("corgis")
     first = r[0]._to_dict()
     self.assertTrue(first)