class documentation

class GeoIP2: (source)

View In Hierarchy

Undocumented

Class Method open Undocumented
Method __del__ Undocumented
Method __init__ Initialize the GeoIP object. No parameters are required to use default settings. Keyword arguments may be passed in to customize the locations of the GeoIP datasets.
Method __repr__ Undocumented
Method city Return a dictionary of city information for the given IP address or Fully Qualified Domain Name (FQDN). Some information in the dictionary may be undefined (None).
Method coords Undocumented
Method country Return a dictionary with the country code and name when given an IP address or a Fully Qualified Domain Name (FQDN). For example, both '24.124.1.80' and 'djangoproject.com' are valid parameters.
Method country_code Return the country code for the given IP Address or FQDN.
Method country_name Return the country name for the given IP Address or FQDN.
Method geos Return a GEOS Point object for the given query.
Method lat_lon Return a tuple of the (latitude, longitude) for the given query.
Method lon_lat Return a tuple of the (longitude, latitude) for the given query.
Constant MODE_AUTO Undocumented
Constant MODE_FILE Undocumented
Constant MODE_MEMORY Undocumented
Constant MODE_MMAP Undocumented
Constant MODE_MMAP_EXT Undocumented
Class Variable cache_options Undocumented
Property info Return information about the GeoIP library and databases in use.
Method _check_query Check the query and database availability.
Instance Variable _city Undocumented
Instance Variable _city_file Undocumented
Instance Variable _country Undocumented
Instance Variable _country_file Undocumented
Property _country_or_city Undocumented
Property _reader Undocumented
@classmethod
def open(cls, full_path, cache): (source)

Undocumented

def __del__(self): (source)

Undocumented

def __init__(self, path=None, cache=0, country=None, city=None): (source)

Initialize the GeoIP object. No parameters are required to use default settings. Keyword arguments may be passed in to customize the locations of the GeoIP datasets. * path: Base directory to where GeoIP data is located or the full path to where the city or country data files (*.mmdb) are located. Assumes that both the city and country data sets are located in this directory; overrides the GEOIP_PATH setting. * cache: The cache settings when opening up the GeoIP datasets. May be an integer in (0, 1, 2, 4, 8) corresponding to the MODE_AUTO, MODE_MMAP_EXT, MODE_MMAP, MODE_FILE, and MODE_MEMORY, `GeoIPOptions` C API settings, respectively. Defaults to 0, meaning MODE_AUTO. * country: The name of the GeoIP country data file. Defaults to 'GeoLite2-Country.mmdb'; overrides the GEOIP_COUNTRY setting. * city: The name of the GeoIP city data file. Defaults to 'GeoLite2-City.mmdb'; overrides the GEOIP_CITY setting.

def __repr__(self): (source)

Undocumented

def city(self, query): (source)

Return a dictionary of city information for the given IP address or Fully Qualified Domain Name (FQDN). Some information in the dictionary may be undefined (None).

def coords(self, query, ordering=('longitude', 'latitude')): (source)

Undocumented

def country(self, query): (source)

Return a dictionary with the country code and name when given an IP address or a Fully Qualified Domain Name (FQDN). For example, both '24.124.1.80' and 'djangoproject.com' are valid parameters.

def country_code(self, query): (source)

Return the country code for the given IP Address or FQDN.

def country_name(self, query): (source)

Return the country name for the given IP Address or FQDN.

def geos(self, query): (source)

Return a GEOS Point object for the given query.

def lat_lon(self, query): (source)

Return a tuple of the (latitude, longitude) for the given query.

def lon_lat(self, query): (source)

Return a tuple of the (longitude, latitude) for the given query.

MODE_AUTO: int = (source)

Undocumented

Value
0
MODE_FILE: int = (source)

Undocumented

Value
4
MODE_MEMORY: int = (source)

Undocumented

Value
8
MODE_MMAP: int = (source)

Undocumented

Value
2
MODE_MMAP_EXT: int = (source)

Undocumented

Value
1
cache_options = (source)

Undocumented

Return information about the GeoIP library and databases in use.

def _check_query(self, query, city=False, city_or_country=False): (source)

Check the query and database availability.

Undocumented

_city_file = (source)

Undocumented

_country = (source)

Undocumented

_country_file = (source)

Undocumented

@property
_country_or_city = (source)

Undocumented

Undocumented