aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/feedgetter.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2013-12-26 17:33:49 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2013-12-26 17:33:49 +0100
commit96d6237c5523e52cfb09162552091b05cc569f8a (patch)
treef554121dfcb60b0edc6a4045b51acfc47c595967 /pyaggr3g470r/feedgetter.py
parentUses the user agent defined in the configuration file. (diff)
downloadnewspipe-96d6237c5523e52cfb09162552091b05cc569f8a.tar.gz
newspipe-96d6237c5523e52cfb09162552091b05cc569f8a.tar.bz2
newspipe-96d6237c5523e52cfb09162552091b05cc569f8a.zip
Logging for the feedgetter module.
Diffstat (limited to 'pyaggr3g470r/feedgetter.py')
-rw-r--r--pyaggr3g470r/feedgetter.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/pyaggr3g470r/feedgetter.py b/pyaggr3g470r/feedgetter.py
index c7f7f81e..b27b63af 100644
--- a/pyaggr3g470r/feedgetter.py
+++ b/pyaggr3g470r/feedgetter.py
@@ -42,8 +42,8 @@ import utils
from flask.ext.mail import Message
from pyaggr3g470r import app, mail
-#import log
-#pyaggr3g470r_log = log.Log()
+import log
+pyaggr3g470r_log = log.Log("feedgetter")
list_of_threads = []
@@ -99,6 +99,7 @@ class FeedGetter(object):
parsed_url = urlparse(r.url)
real_url = parsed_url.scheme + '://' + parsed_url.netloc + parsed_url.path
except:
+ pyaggr3g470r_log.warning("Unable to get the real URL of " + article.link)
real_url = article.link
if models.Article.objects(link=real_url).first() != None:
@@ -132,7 +133,8 @@ class FeedGetter(object):
article = models.Article(post_date, real_url, article_title, description, False, False)
try:
article.save()
- except:
+ except Exception as e:
+ pyaggr3g470r_log.error("Error when inserting article in database: " + str(e))
continue
articles.append(article)
@@ -140,8 +142,7 @@ class FeedGetter(object):
try:
search.add_to_index([article], feed)
except Exception as e:
- print("Whoosh error: " + str(e))
- #pyaggr3g470r_log.error("Whoosh error.")
+ pyaggr3g470r_log.error("Whoosh error.")
continue
# email notification
bgstack15