def tweets(self):
"""
Generator yielding the last tweets (200 is the API limit) since the
last tweet saved in Jarbas database. If no tweet is saved it yields the
last 200 tweets.
"""
kwargs = dict(
screen_name='RosieDaSerenata',
count=200, # this is the maximum suported by Twitter API
include_rts=False,
exclude_replies=True
)
latest_tweet = Tweet.objects.first()
if latest_tweet:
kwargs['since_id'] = latest_tweet.status
api = twitter.Api(*self.credentials, sleep_on_rate_limit=True)
yield from api.GetUserTimeline(**kwargs)
评论列表
文章目录