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)
|
logger.debug('Got non-200 response for IP %s: %s', ip_address, r.status_code)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logger.debug('Got IP data for IP %s: %s => %s', ip_address, r.status_code, r.json)
|
logger.debug('Got IP data for IP %s: %s => %s', ip_address, r.status_code, r.json())
|
||||||
threat_data = r.json.get('threat', {})
|
threat_data = r.json().get('threat', {})
|
||||||
return threat_data.get('is_threat', False) or threat_data.get('is_bogon', False)
|
return threat_data.get('is_threat', False) or threat_data.get('is_bogon', False)
|
||||||
except requests.RequestException:
|
except requests.RequestException:
|
||||||
logger.exception('Got exception when trying to lookup IP Address')
|
logger.exception('Got exception when trying to lookup IP Address')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logger.exception('Got exception when trying to lookup IP Address')
|
logger.exception('Got exception when trying to lookup IP Address')
|
||||||
|
except Exception:
|
||||||
|
logger.exception('Got exception when trying to lookup IP Address')
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Reference in a new issue