当前位置: 首页>>代码示例>>Python>>正文


Python PageImporter.fetch_page方法代码示例

本文整理汇总了Python中apps.rss_feeds.page_importer.PageImporter.fetch_page方法的典型用法代码示例。如果您正苦于以下问题:Python PageImporter.fetch_page方法的具体用法?Python PageImporter.fetch_page怎么用?Python PageImporter.fetch_page使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在apps.rss_feeds.page_importer.PageImporter的用法示例。


在下文中一共展示了PageImporter.fetch_page方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: or

# 需要导入模块: from apps.rss_feeds.page_importer import PageImporter [as 别名]
# 或者: from apps.rss_feeds.page_importer.PageImporter import fetch_page [as 别名]
            feed = self.refresh_feed(feed.pk)
            if (
                (self.options["force"])
                or (random.random() > 0.9)
                or (
                    fetched_feed
                    and feed.feed_link
                    and feed.has_page
                    and (ret_feed == FEED_OK or (ret_feed == FEED_SAME and feed.stories_last_month > 10))
                )
            ):

                logging.debug(u"   ---> [%-30s] ~FYFetching page: %s" % (feed.title[:30], feed.feed_link))
                page_importer = PageImporter(feed)
                try:
                    page_data = page_importer.fetch_page()
                    page_duration = time.time() - start_duration
                except TimeoutError, e:
                    logging.debug("   ---> [%-30s] ~FRPage fetch timed out..." % (feed.title[:30]))
                    page_data = None
                    feed.save_page_history(555, "Timeout", "")
                except Exception, e:
                    logging.debug("[%d] ! -------------------------" % (feed_id,))
                    tb = traceback.format_exc()
                    logging.error(tb)
                    logging.debug("[%d] ! -------------------------" % (feed_id,))
                    feed.save_page_history(550, "Page Error", tb)
                    fetched_feed = None
                    page_data = None
                    mail_feed_error_to_admin(feed, e, local_vars=locals())
开发者ID:zhudonghe,项目名称:NewsBlur,代码行数:32,代码来源:feed_fetcher.py

示例2: mail_feed_error_to_admin

# 需要导入模块: from apps.rss_feeds.page_importer import PageImporter [as 别名]
# 或者: from apps.rss_feeds.page_importer.PageImporter import fetch_page [as 别名]
     ret_feed = FEED_ERREXC 
     feed.save_feed_history(500, "Error", tb)
     fetched_feed = None
     mail_feed_error_to_admin(feed, e)
 
 feed = self.refresh_feed(feed_id)
 if ((self.options['force']) or 
     (fetched_feed and
      feed.feed_link and
      (ret_feed == FEED_OK or
       (ret_feed == FEED_SAME and feed.stories_last_month > 10)))):
       
     logging.debug(u'   ---> [%-30s] Fetching page: %s' % (unicode(feed)[:30], feed.feed_link))
     page_importer = PageImporter(feed.feed_link, feed)
     try:
         page_importer.fetch_page()
     except TimeoutError, e:
         logging.debug('   ---> [%-30s] Page fetch timed out...' % (unicode(feed)[:30]))
         feed.save_page_history(555, 'Timeout', '')
     except Exception, e:
         logging.debug('[%d] ! -------------------------' % (feed_id,))
         tb = traceback.format_exc()
         logging.error(tb)
         logging.debug('[%d] ! -------------------------' % (feed_id,))
         feed.save_page_history(550, "Page Error", tb)
         fetched_feed = None
         mail_feed_error_to_admin(feed, e)
         
     logging.debug(u'   ---> [%-30s] Fetching icon: %s' % (unicode(feed)[:30], feed.feed_link))
     icon_importer = IconImporter(feed, force=self.options['force'])
     try:
开发者ID:rkabir,项目名称:NewsBlur,代码行数:33,代码来源:feed_fetcher.py


注:本文中的apps.rss_feeds.page_importer.PageImporter.fetch_page方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。