Trending_Bot.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:Trending-Places-in-OpenStreetMap 作者: geometalab 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号