]> git.sommitrealweird.co.uk Git - rss2maildir.git/blobdiff - rss2maildir.py
* fix typo for a particular entity
[rss2maildir.git] / rss2maildir.py
index 4402c43884ae5271a201de8529ebc46271a5fcdc..32a39f6243d1f21523eb437e1c9885462c2a16c7 100755 (executable)
@@ -53,7 +53,7 @@ entities = {
     "pound": "£",
     "copy": "©",
     "apos": "'",
-    "quote": "\"",
+    "quot": "\"",
     "nbsp": " ",
     }
 
@@ -299,7 +299,12 @@ def parse_and_deliver(maildir, url, statedir):
     else:
         conn = httplib.HTTPConnection("%s:%s" %(host, port))
         conn.request("GET", path)
-        response = conn.getresponse()
+        response = None
+        try:
+            response = conn.getresponse()
+        except:
+            print "Failed to fetch feed: %s" %(url)
+            return
         headers = response.getheaders()
         feedhandle = response
 
@@ -347,8 +352,13 @@ def parse_and_deliver(maildir, url, statedir):
         msg.add_header("To", "\"%s\" <rss2maildir@localhost>" %(url))
         if prevmessageid:
             msg.add_header("References", prevmessageid)
-        createddate = datetime.datetime(*item["updated_parsed"][0:6]) \
+        createddate = datetime.datetime.now() \
             .strftime("%a, %e %b %Y %T -0000")
+        try:
+            createddate = datetime.datetime(*item["updated_parsed"][0:6]) \
+                .strftime("%a, %e %b %Y %T -0000")
+        except:
+            pass
         msg.add_header("Date", createddate)
         msg.add_header("Subject", item["title"])
         msg.set_default_type("text/plain")