Mercurial > feed2twitter
changeset 10:3feb97c3716f
better exception verification
author | Walter Cruz <walter@waltercruz.com> |
---|---|
date | Mon, 26 May 2008 09:59:32 -0300 |
parents | 58fe9277b7fc |
children | f3902e658945 |
files | feed2twitter/feed2twitter/__init__.py |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/feed2twitter/feed2twitter/__init__.py Fri May 16 19:08:06 2008 -0300 +++ b/feed2twitter/feed2twitter/__init__.py Mon May 26 09:59:32 2008 -0300 @@ -21,6 +21,7 @@ from pprint import pprint from tinyurl import tiny from httplib import BadStatusLine +from urllib2 import HTTPError class Feed2Twitter(object): def __init__(self, url, username, passwd): @@ -39,8 +40,9 @@ self.rss.updateLastRead(it) print "status: ", status.text time.sleep(5) - except BadStatusLine: - pass + except (BadStatusLine, HTTPError): + #lets try in the nex ttime + return def update(self): lastread = self.rss.getlastRead() @@ -49,7 +51,6 @@ self.rss.updateLastRead() else: lista = [item for item in self.rss.feed['items'] if item['updated_parsed'] > lastread] - #print(lista) self.twitIt(reversed(lista[:5])) self.rss.updateLastRead()