resumeasebo.blogg.se

Maxmind db reader
Maxmind db reader














Is provided, the address that the web service is called from will Ip_address – IPv4 or IPv6 address as a string. country ( ip_address: Union = 'me' ) → ¶Ĭall the GeoIP2 Country endpoint with the specified IP. This will close the session and any associated connections. If noĪddress is provided, the address that the web service is It may optionally includeĪ basic auth username and password, ( ip_address: Union = 'me' ) → ¶Ĭall City endpoint with the specified IP.

  • proxy – The URL of an HTTP proxy to use.
  • This sets both the connect timeout and the read timeout.
  • timeout – The timeout in seconds to use when waiting on the request.
  • en – English names may still include accented characters if that is.
  • May end up returning None even when the record has an English name. If you do not include this locale, the name property

    maxmind db reader

    Note that the only locale which is always present in the GeoIP2ĭata is “en”. The name in the first locale that has one. Multiple names (country, city, etc.), its name property will return Passed on to record classes to use when their name properties are To use the GeoLite2 web service instead of GeoIP2

  • host – The hostname to make a request against.
  • maxmind db reader

    The following keyword arguments are also accepted: Parameters:

    #Maxmind db reader license#

  • license_key – Your MaxMind license key.
  • It accepts the following required arguments: Parameters: AsyncClient ( account_id: int, license_key: str, host: str = '', locales: Optional] = None, timeout: float = 60, proxy: Optional = None ) ¶ Requests to the web service are always made with SSL. Get the Enterprise object for the IP address. Parameters:Įnterprise ( ip_address: Union ) → ¶ Get the Domain object for the IP address. Parameters:ĭomain ( ip_address: Union ) → ¶ Get the Country object for the IP address. Parameters:Ĭountry ( ip_address: Union ) → ¶ Get the ConnectionType object for the IP address. connection_type ( ip_address: Union ) → ¶ Parameters:Ĭity ( ip_address: Union ) → ¶ Ip_address – IPv4 or IPv6 address as a string.Īsn ( ip_address: Union ) → ¶ Get the AnonymousIP object for the IP address. If theĭatabase is corrupt or invalid, a maxminddb.InvalidDatabaseError willīe thrown. If the address is not in the database, an If theĭatabase does not contain the requested information, the attributes on the 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 the You then call the method corresponding to the specific database, passing First, youĬreate a reader object, specifying a file name or file descriptor. The basic API for this class is the same for every database. IP addresses can be looked up using the country and city methods. Instances of this class provide a reader for the GeoIP2 database format. Reader ( fileish: Union, locales: Optional] = None, mode: int = 0 ) ¶ GeoIP2 Database Reader ¶ class geoip2.database.

    maxmind db reader

    enterprise method to do a lookup in the Enterprise database > response = reader. Reader ( '/path/to/GeoIP2-Enterprise.mmdb' ) as reader : > # Use the. You should use the same object > # across multiple requests as creation of it is expensive. > import geoip2.database > # This creates a Reader object. Please > # note that Insights is not supported by the GeoLite2 web service. AsyncClient ( 42, 'license_key' ) as client : > # Replace "city" with the method corresponding to the web service > # that you are using, i.e., "country", "city", or "insights". Set the "host" keyword argument to "" to use the > # GeoLite2 web service instead of GeoIP2 Precision. > # > # Replace "42" with your account ID and "license_key" with your license > # key. If you are using multiple event > # loops, you must ensure the object is not used on another loop.

    maxmind db reader

    > import asyncio > import geoip2.webservice > async def main (): > # This creates an AsyncClient object that can be reused across > # requests on the running event loop. Client ( 42, 'license_key' ) as client : > # Replace "city" with the method corresponding to the web service > # that you are using, i.e., "country", "city", or "insights". > # Replace "42" with your account ID and "license_key" with your license > # key. import geoip2.webservice > # This creates a Client object that can be reused across requests.














    Maxmind db reader