check exception attribute (closes #581)
This commit is contained in:
parent
05a6bb79e4
commit
cb1478f455
1 changed files with 1 additions and 1 deletions
|
|
@ -293,7 +293,7 @@ class BaseBrowser(mechanize.Browser):
|
|||
return mechanize.Browser.open(self, *args, **kwargs)
|
||||
|
||||
def get_exception(self, e):
|
||||
if isinstance(e, urllib2.HTTPError) and e.getcode() == 404:
|
||||
if isinstance(e, urllib2.HTTPError) and hasattr(e, 'getcode') and e.getcode() == 404:
|
||||
return BrowserHTTPNotFound
|
||||
else:
|
||||
return BrowserHTTPError
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue