The official Python client library for the IPinfo API, providing comprehensive IP address details like geolocation, ASN, company, privacy detection, and more. It offers both synchronous and asynchronous interfaces. As of version 5.5.0, it supports new IPinfo Core and Plus API features. The library maintains an active development status with regular, feature-driven releases.
pip install ipinfoVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the synchronous IPinfo client and perform lookups for your own IP address and a specific IP address. Ensure your IPinfo access token is provided either via an environment variable or directly in the code.
For asynchronous operations, ensure you import `AsyncHandler` from `ipinfo.handler_async` and use `await` with its methods. Do not mix sync and async clients/methods.
Review the documentation for `getBatchDetails` and adjust existing batch processing logic to leverage the new options for optimal performance and error handling, especially for large lists of IPs.
Consider custom cache implementation (e.g., Redis, disk-based) for production environments or configure the existing cache `ttl` and `maxsize` parameters when initializing the client.
Always gracefully handle potentially missing or new fields in the `Details` object, especially when accessing new features or migrating to a higher API tier. Refer to the official IPinfo API documentation for the latest data structures.
Ensure you are using the correct client type for your desired operation. For async operations, use `AsyncHandler` and `await client.getDetails_async()`. For sync, use `Handler` and `client.getDetails()`.
Pass your IPinfo API access token as the first argument when creating a client instance: `client = Handler('YOUR_ACCESS_TOKEN')` or ensure the `IPINFO_TOKEN` environment variable is set.Verify that your IPinfo access token is correct, has not expired, and has the necessary permissions. Regenerate if necessary from your IPinfo dashboard.
You `await` the *methods* of the `AsyncHandler` instance, not the instance itself. For example: `details = await client.getDetails()`.
No dependency data recorded yet.