get_geoip_db

privex.helpers.plugin.get_geoip_db(geo_type: str)str[source]

Return the full path to the GeoIP2 database for geo_type.

If we haven’t yet scanned the search paths for the database, then _find_geoip() will be called to try and locate the database file.

If the database is found, the _DETECTED boolean setting will be changed to True so we know that the path contained in the get_geodbs() result is valid in the future, avoiding unnecessary searches.

If the database can’t be found anywhere within the search paths, GeoIPDatabaseNotFound will be raised.

Parameters

geo_type (str) – The GeoIP database type: either ‘city’, ‘asn’ or ‘country’

Raises

GeoIPDatabaseNotFound – If the database for geo_type could not be found.

Return str path

The full path to the detected GeoIP database