Merge pull request #3066 from quay/ipresolver-bug

Missing parens on IP resolver lookup
This commit is contained in:
josephschorr 2018-05-04 02:17:53 +03:00 committed by GitHub
commit f0ec26ea54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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