From 8a72e6ae786ffde8e841afbe725a19b3b874f87e Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Mon, 11 Jan 2016 10:16:41 +0100 Subject: fixing stuffs * no more warning on constructing feeds * using the configured user agent for constructing feed * regrouping the logic behind knowing if the parsing of a feed worked --- src/crawler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/crawler.py') diff --git a/src/crawler.py b/src/crawler.py index 22e73754..1a759945 100644 --- a/src/crawler.py +++ b/src/crawler.py @@ -37,7 +37,7 @@ import conf from bootstrap import db from web.models import User from web.controllers import FeedController, ArticleController -from web.lib.feed_utils import construct_feed_from +from web.lib.feed_utils import construct_feed_from, is_parsing_ok from web.lib.article_utils import construct_article, extract_id logger = logging.getLogger(__name__) @@ -87,7 +87,7 @@ async def parse_feed(user, feed): FeedController().update({'id': feed.id}, up_feed) return - if parsed_feed['bozo'] == 1 and parsed_feed['entries'] == []: + if not is_parsing_ok(parsed_feed): up_feed['last_error'] = str(parsed_feed['bozo_exception']) up_feed['error_count'] = feed.error_count + 1 FeedController().update({'id': feed.id}, up_feed) -- cgit