comparison bitsyblog/blogme.py @ 65:4e41e1084e56

better exception handling, i hope; i hate lost messages
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 13 Apr 2010 13:59:43 -0700
parents 04866e5abb5a
children 894a2e76bd40
comparison
equal deleted inserted replaced
64:292aeb1741f3 65:4e41e1084e56
137 for i in range(attempts): 137 for i in range(attempts):
138 try: 138 try:
139 connection = urllib2.urlopen(url, data=msg) 139 connection = urllib2.urlopen(url, data=msg)
140 print connection.url # print the blog post's url 140 print connection.url # print the blog post's url
141 break 141 break
142 except urllib2.HTTPError, e: 142 except (urllib2.HTTPError, urllib2.URLError), e:
143 import pdb; pdb.set_trace() 143 continue
144 print e 144 else:
145 print >> sys.stderr, e
146 print msg
145 147
146 if __name__ == '__main__': 148 if __name__ == '__main__':
147 main() 149 main()