X-Git-Url: https://git.sommitrealweird.co.uk/rss2maildir.git/blobdiff_plain/03e4620598f673f0148f8dd4041576fb8947469b..8b1be1378edae49d57890b35bda0d18b399258fd:/rss2maildir.py diff --git a/rss2maildir.py b/rss2maildir.py index 4402c43..d8cd3e4 100755 --- a/rss2maildir.py +++ b/rss2maildir.py @@ -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\" " %(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")