當前位置: 首頁>>代碼示例>>Python>>正文


Python page_importer.PageImporter類代碼示例

本文整理匯總了Python中apps.rss_feeds.page_importer.PageImporter的典型用法代碼示例。如果您正苦於以下問題:Python PageImporter類的具體用法?Python PageImporter怎麽用?Python PageImporter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了PageImporter類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: or

                    feed_code = 550

            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
開發者ID:zhudonghe,項目名稱:NewsBlur,代碼行數:31,代碼來源:feed_fetcher.py

示例2: mail_feed_error_to_admin

     logging.error(tb)
     logging.debug('[%d] ! -------------------------' % (feed_id,))
     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))
開發者ID:rkabir,項目名稱:NewsBlur,代碼行數:31,代碼來源:feed_fetcher.py


注:本文中的apps.rss_feeds.page_importer.PageImporter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。