Permalink
Browse files

Handle urllib HTTPError

  • Loading branch information...
kevinmehall committed Apr 14, 2012
1 parent 45efa78 commit df978c4afc5610c3e3810d081e688e7e41a0292b
Showing with 3 additions and 0 deletions.
  1. +3 −0 pithos/pandora/pandora.py
@@ -118,6 +118,9 @@ def xmlrpc_call(self, method, args=[], url_args=True, secure=False, includeTime=
req = urllib2.Request(url, data, {'User-agent': USER_AGENT, 'Content-type': 'text/xml'})
response = self.opener.open(req, timeout=HTTP_TIMEOUT)
text = response.read()
+ except urllib2.HTTPError as e:
+ logging.error("HTTP error: %s", e)
+ raise PandoraNetError(str(e))
except urllib2.URLError as e:
logging.error("Network error: %s", e)
if e.reason[0] == 'timed out':

0 comments on commit df978c4

Please sign in to comment.