aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/crawler.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2015-03-05 07:15:44 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2015-03-05 07:15:44 +0100
commitda3ac55fc2abedc7b8864dabe180b0ff6ef5a1a2 (patch)
treecbeb8a3df3e6e7334d58c7231067d095a62cb0c9 /pyaggr3g470r/crawler.py
parentMisplaced point. (diff)
downloadnewspipe-da3ac55fc2abedc7b8864dabe180b0ff6ef5a1a2.tar.gz
newspipe-da3ac55fc2abedc7b8864dabe180b0ff6ef5a1a2.tar.bz2
newspipe-da3ac55fc2abedc7b8864dabe180b0ff6ef5a1a2.zip
Take advantage of some new fields of the Feed objects.
Diffstat (limited to 'pyaggr3g470r/crawler.py')
-rw-r--r--pyaggr3g470r/crawler.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/pyaggr3g470r/crawler.py b/pyaggr3g470r/crawler.py
index 56c3552a..22ed5acc 100644
--- a/pyaggr3g470r/crawler.py
+++ b/pyaggr3g470r/crawler.py
@@ -55,7 +55,8 @@ def get(*args, **kwargs):
response = yield from aiohttp.request('GET', *args, **kwargs)
return (yield from response.read_and_close(decode=False))
except Exception as e:
- print(e)
+ #print(e)
+ feed.last_error = str(e)
return None
@asyncio.coroutine
@@ -69,7 +70,11 @@ def parse_feed(user, feed):
data = yield from get(feed.link)
if data is None:
+ feed.error_count += 1
return
+ feed.error_count = 0
+
+ feed.last_retrieved = datetime.now()
a_feed = feedparser.parse(data)
if a_feed['bozo'] == 1:
bgstack15