for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
from geoip2.errors import AddressNotFoundError
def ip_asn(app, ip):
try:
reader = app.config.get("trdb").get("mmdb")
except:
return None
ret = reader.isp(ip)
except AddressNotFoundError:
return ret