Missing parens on IP resolver lookup
Also adds a generic catch in case this happens again; we should *never* fail
This commit is contained in:
parent
bf943e7713
commit
942f526016
1 changed files with 4 additions and 2 deletions
|
@ -78,13 +78,15 @@ class IPResolver(IPResolverInterface):
|
|||
logger.debug('Got non-200 response for IP %s: %s', ip_address, r.status_code)
|
||||
return False
|
||||
|
||||
logger.debug('Got IP data for IP %s: %s => %s', ip_address, r.status_code, r.json)
|
||||
threat_data = r.json.get('threat', {})
|
||||
logger.debug('Got IP data for IP %s: %s => %s', ip_address, r.status_code, r.json())
|
||||
threat_data = r.json().get('threat', {})
|
||||
return threat_data.get('is_threat', False) or threat_data.get('is_bogon', False)
|
||||
except requests.RequestException:
|
||||
logger.exception('Got exception when trying to lookup IP Address')
|
||||
except ValueError:
|
||||
logger.exception('Got exception when trying to lookup IP Address')
|
||||
except Exception:
|
||||
logger.exception('Got exception when trying to lookup IP Address')
|
||||
|
||||
return False
|
||||
|
||||
|
|
Reference in a new issue