don't crash when website is not available
This commit is contained in:
parent
d15e2ab65e
commit
d582d367dc
1 changed files with 3 additions and 0 deletions
|
|
@ -44,6 +44,9 @@ class IpinfodbBackend(BaseBackend, ICapGeolocIp):
|
||||||
|
|
||||||
content = self.browser.readurl('http://ipinfodb.com/ip_locator.php?ip=%s' % str(ipaddr))
|
content = self.browser.readurl('http://ipinfodb.com/ip_locator.php?ip=%s' % str(ipaddr))
|
||||||
|
|
||||||
|
if content is None:
|
||||||
|
raise BrowserUnavailable()
|
||||||
|
|
||||||
if 'Invalid IP or domain name' in content:
|
if 'Invalid IP or domain name' in content:
|
||||||
raise Exception('Bad parameter')
|
raise Exception('Bad parameter')
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue