Skip to main content

grip-client

Python client for the GRIP API.

from grip_client.rest import GRIPClient

client = GRIPClient(token="token", timeout=5.0)
response = client.response_ip("8.8.8.8")

print(response.ip)
print(response.country_iso)

Optional in-memory caching:

from grip_client.rest import GRIPClient, CachetoolsCache

client = GRIPClient(
    token="token",
    cache=CachetoolsCache(ttl=300, maxsize=1024),
)
response = client.response_ip("8.8.8.8")

Optional Redis caching:

from grip_client.rest import GRIPClient, RedisCache

client = GRIPClient(
    token="token",
    cache=RedisCache.from_url("redis://localhost:6379/0", ttl=300),
)
response = client.response_ip("8.8.8.8")

MMDB local lookup:

Features:

  • MMDB downloads use the gzipped asset by default, and cache the decompressed .mmdb on disk.
  • Files are updated asynchronously every hour.
  • Reader is thread-safe
from grip_client.mmdb import GRIPMMDBClient

mmdb = GRIPMMDBClient(token="token")
res = mmdb.lookup("8.8.8.8")

print(
    f"{res.asn.network_operator=}, "
    f"{res.country.country_iso=}, "
    f"{res.anonymous.is_anonymous=}"
)

Individual MMDBs can be used directly:

from grip_client.mmdb import GRIPMMDB, GRIPMMDBKind

anonymous = GRIPMMDB(
    kind=GRIPMMDBKind.GRIP_ANONYMOUS,
    max_age_seconds=3600,
    token="token"
)

if anonymous.is_anonymous("8.8.8.8"):
    print("skip API lookup")

Metadata

Release files for grip-client 0.1.2

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

Source distribution (sdist)

Source distribution for grip-client 0.1.2
File Size Uploaded
grip_client-0.1.2.tar.gz 9.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for grip-client 0.1.2
File Interpreter ABI Platform
grip_client-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 21.1 kB

Release files / grip_client-0.1.2.tar.gz

Download URL grip_client-0.1.2.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
393e10f1e439a316cfb3d5a9c1d9028ee09af270330a0e6b996a1cd3202c839b
BLAKE2b-256 checksum
How to use checksums
bae442417e5a9b82c7b9b94c6972e9c3d6f1a08e6bf9ea0c033965153a497ecc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / grip_client-0.1.2-py3-none-any.whl

Download URL grip_client-0.1.2-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70e7bbd62e9c9457bf0bb813463027755d6799aa025324daaa3e5202915e7bb0
BLAKE2b-256 checksum
How to use checksums
6d103ee7d7889d608cc1e8937849948813b1d549f8add81bce699c96c7e54fac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release history Release notifications | RSS feed

0.1.3

2 release files

This release

0.1.2 This release

2 release files

0.1.1

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