本文整理汇总了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())
示例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: