

> 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.
