keropatom.blogg.se

Maxmind db reader
Maxmind db reader






maxmind db reader
  1. #MAXMIND DB READER ISO#
  2. #MAXMIND DB READER DOWNLOAD#

If the address is not in the database, exception will be On the record class will have a null value. The database does not contain the requested information, the attributes This model in turn contains multiple record classes,Įach of which represents part of the data returned by the database. If the request succeeds, the method call will return a model class for You then call the methodĬorresponding to the specific database, passing it the IP address you want First, youĬreate a reader object, specifying a file name. Once created, the Reader is safe to use for lookups from multiple threads.

maxmind db reader

If youre performing multiple lookups, its most efficient to create one Reader and reuse it. Create a Reader for looking up IP addresses in a GeoIP2/GeoLite2 database file. The basic API for this class is the same for every database. initialize(database:, locales: en, mode: MaxMind::DB::MODEAUTO) Reader. IP addresses can be looked up using the database specific methods. Ip_address – an IP address in the standard string notation metadata ( ) → of this class provide a reader for the GeoIP2 database format. Reader ( database: Union, mode: int = 0 ) ¶ The bit size of a record in the search tree. A database with a value of “6” may supportĪ list of locale codes supported by the databse. A value of “4” means theĭatabase only supports IPv4. The IP version of the data in a database. Type:Ī map from locales to text descriptions of the database. Type:Ī string identifying the database type, e.g., “GeoIP2-City”. The Unix epoch for the build time of the database. The minor version number of the binary format used when creating the The major version number of the binary format used when creating the Metadata for the MaxMind DB reader binary_format_major_version ¶ This module contains the pure Python database reader and related classes.

  • MODE_AUTO - tries MODE_MMAP_EXT, MODE_MMAP, MODE_FILE in that order.
  • MODE_FD - the param passed via database is a file descriptor, not a path.
  • Open a MaxMind DB database Arguments: database – A path to a valid MaxMind DB file such as a GeoIP2 database file, or a file descriptor in the case of MODE_FD. It is packaged as libmaxmind-db-reader-xs-perl and approximately 100 times faster than the pure Perl implementation. There is a separate distribution that provides an XS implementation, which links against libmaxminddb. open_database ( database: Union, mode: int = 0 ) → ¶ The MaxMind-DB-Reader distribution ships with a single pure Perl implementation of the Reader API. Return the metadata associated with the MaxMind DB file maxminddb. Ip_address – an IP address in the standard string notation metadata ( ) → ¶ Return a tuple with the record and the associated prefix length

    maxmind db reader

    Ip_address – an IP address in the standard string notation get_with_prefix_len ( ip_address: Union ) → Tuple, int] ¶ Return the record for the ip_address in the MaxMind DB

    maxmind db reader

    close ( ) → None ¶Ĭloses the MaxMind DB file and returns the resources to the system get ( ip_address: Union ) → Union ¶ IPĪddresses can be looked up using the get method. Instances of this class provide a reader for the MaxMind DB format. This error is thrown when unexpected data is found in the database. This returns a tuple containing the recordįollowed by the network prefix length associated with the record. If you wish to also retrieve the prefix length for the record, use the That IP address, the method will return None. If the database does not contain a record for The method will return theĬorresponding values for the IP address from the database (e.g., a dictionaryįor GeoIP2/GeoLite2 databases). To look up an IPĪddress, use the get method on this object. The open_database function returns a Reader object. The caller may close theįile descriptor immediately after the Reader object is created. Sure that the file descriptor gets closed properly. NOTE: When using MODE_FD, it is the caller’s responsibility to be

  • MODE_AUTO - try MODE_MMAP_EXT, MODE_MMAP, MODE_FILE in that.
  • MODE_FD - load database into memory from a file descriptor.
  • MODE_MEMORY - load database into memory.
  • MODE_FILE - read database as standard file.
  • MODE_MMAP_EXT - use the C extension with memory map.
  • Open_database with a path, or file descriptor (in the case of MODE_FD), WeĪfter you have obtained a database and imported the module, call

    #MAXMIND DB READER ISO#

    We source things like place names, ISO codes, and other similar data from the GeoNames premium data set. Some of the data that MaxMind provides is also sourced from GeoNames.

    #MAXMIND DB READER DOWNLOAD#

    To use this module, you must first download or create a MaxMind DB file. This is the ID of a geographical feature (city, region, country, etc.) in the GeoNames database.








    Maxmind db reader