Skip to main content

ipmax

Python client for the IP-Max GeoIP and IP intelligence API, with sync and async clients and fully typed responses.

Install

pip install ipmax

Requires Python 3.10 or newer.

Quickstart

from ipmax import IPMax

with IPMax("sg_live_...") as client:
    geo = client.geoip("8.8.8.8")
    print(geo.geo.city, geo.geo.country_code, geo.as_.name)

    intel = client.intelligence("8.8.8.8")
    print(intel.network_class.primary, intel.is_hosting)

The async client has the same methods:

import asyncio

from ipmax import AsyncIPMax


async def main() -> None:
    async with AsyncIPMax() as client:
        catalog = await client.catalog()
        account = await client.account()
        print(catalog.prices, account.wallets)


asyncio.run(main())

When no key is passed, the client reads IPMAX_API_KEY from the environment. catalog() works without a key.

Every lookup is billed and sends a fresh Idempotency-Key, which is reused when the request is retried. Pass your own with client.geoip(ip, idempotency_key="...") to make a lookup safe to repeat across processes.

Configuration

Option Default Description
api_key IPMAX_API_KEY API key sent as a bearer token
base_url https://api.ipm.ax API origin
timeout 10.0 Seconds per attempt
max_retries 2 Retries on network errors, 408, 429 and 5xx, with exponential backoff and Retry-After support
cache_size 1024 Successful lookups kept in memory; 0 disables the cache
cache_ttl 300.0 Seconds a cached lookup stays fresh
http_client new client Your own httpx.Client or httpx.AsyncClient, for proxies or custom transports

Cached lookups make no request and cost nothing. catalog() and account() are never cached. A lookup with an explicit idempotency key always goes to the API.

Error handling

import ipmax

try:
    client.geoip("8.8.8.8")
except ipmax.InsufficientBalanceError:
    ...
except ipmax.RateLimitError as error:
    print("retry in", error.retry_after)
except ipmax.ApiError as error:
    print(error.status, error.code, error.message, error.request_id)
except ipmax.ConnectionError:
    ...
Exception When
IPMaxError Base class for everything below
ApiError Any non-2xx response; carries status, code, message, request_id, retryable, retry_after
InvalidRequestError 400, 413, 415
AuthenticationError 401
InsufficientBalanceError 402
NotFoundError 404
ConflictError 409
RateLimitError 429
ServerError 5xx
ConnectionError The request could not be completed
TimeoutError The request timed out; a subclass of ConnectionError

ErrorCode holds the known values of error.code, such as ErrorCode.INSUFFICIENT_BALANCE. New codes may appear and are passed through as plain integers.

License

Apache-2.0

Metadata

Release files for ipmax 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ipmax 0.1.0
File Size Uploaded
ipmax-0.1.0.tar.gz 24.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ipmax 0.1.0
File Interpreter ABI Platform
ipmax-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.6 kB

Release files / ipmax-0.1.0.tar.gz

Download URL ipmax-0.1.0.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9d9df61ce588564a96fe3e3e76a0624d1ca73ba4a0196fe9e5b5fad1ea1a35e3
BLAKE2b-256 checksum
How to use checksums
7f033a93f4742374b5a04bc2ff5964f5759a264eb8f1a5e979e3a031850be2cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / ipmax-0.1.0-py3-none-any.whl

Download URL ipmax-0.1.0-py3-none-any.whl
Size 15.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f11d4bcde7308969e30f99484f877e9b6001118b67b83dab2818ad97f34f7c7b
BLAKE2b-256 checksum
How to use checksums
02f90003400fe9cddaa3a8a6a337490d132592b06b46cdafc09c540e2afd018d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page