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")

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grip_client-0.1.2.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grip_client-0.1.2-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file grip_client-0.1.2.tar.gz.

File metadata

  • Download URL: grip_client-0.1.2.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.7

File hashes

Hashes for grip_client-0.1.2.tar.gz
Algorithm Hash digest
SHA256 393e10f1e439a316cfb3d5a9c1d9028ee09af270330a0e6b996a1cd3202c839b
MD5 7feab4746e5c14884315c59c640247f5
BLAKE2b-256 bae442417e5a9b82c7b9b94c6972e9c3d6f1a08e6bf9ea0c033965153a497ecc

See more details on using hashes here.

File details

Details for the file grip_client-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: grip_client-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.7

File hashes

Hashes for grip_client-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 70e7bbd62e9c9457bf0bb813463027755d6799aa025324daaa3e5202915e7bb0
MD5 99c1f9ebb8c4ed1192e17bf19b97828f
BLAKE2b-256 6d103ee7d7889d608cc1e8937849948813b1d549f8add81bce699c96c7e54fac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page