allstargaq.blogg.se

Maxmind api
Maxmind api










maxmind api

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.

maxmind api

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. 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 the GeoIP2 web service. > # > # 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. > 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 api