def tweet_status_trends(self):
"""
Tweets the top trending places
"""
logging.info("Updating status with Trending places....")
try:
base_text = "Top trending places in #OSM " + DATE.strftime('%d/%m') + ': '
end_text = ''
count_available = TWITTER_STATUS_LIMIT - len(base_text) - len(end_text)
text = Ft().get_cities_from_file(str(DATE.date()), REGION, count_available)
img = Ft.get_trending_graph(str(DATE.date()), REGION)
if text:
self.api.update_with_media(img, base_text + text + end_text)
self.state['last_tweet'] = time.time()
else:
self.api.update_status(ERROR_MSG)
logging.info("Could not update status. Rechecking in a while....")
except tweepy.TweepError as e:
self._log_tweepy_error('Can\'t update status because', e)
Trending_Bot.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录