1. Benoit Boissinot
  2. jorf2rss

Commits

Benoit Boissinot  committed 6e77173

add logging

  • Participants
  • Parent commits 292282c
  • Branches default

Comments (0)

Files changed (1)

File main.py

View file
 defaultfeed = 10
 
 def newarticle(d):
-    try:
-        date, url, html = fetch(d)
-    except Exception, err:
-        logging.info("Failed to fetch %s" % err)
-        return
+    date, url, html = fetch(d)
     link = "http://www.legifrance.gouv.fr/rechJO.do?champJour=%02d&champMois=%02d&champAnnee=%04d&bouton=Rechercher" % (d.day, d.month, d.year)
     a = FeedArticle(title="Journal Officiel du %s" % date, link=cgi.escape(link),
                     id=url, html=html, timestamp=datetime.combine(d, time(6)))
     a.put()
+    logging.debug("Added new JORF")
 
 class Feed(object):
     def __init__(self):
                 except Exception, err:
                     logging.info("Init: failed to fetch %s" % err)
 
-        if self.last_update.timestamp + timedelta(hours=3) < now and last[0].timestamp.date() != today:
+        if self.last_update.timestamp + timedelta(hours=3) < now and last[0].timestamp.date() < today:
             try:
                 newarticle(today)
             except Exception, err: