Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def load_mmdb(db_path):
reader = maxminddb.Reader(db_path)
def fetch_geo_data(ip):
data = reader.get(ip)
return {
'country_code': data['country']['iso_code'].lower(),
'country_name': data['country']['names']['en'],
}
return fetch_geo_data