Skip to main content

InternetData InternetData Python Client Library

PyPI license

The official Python client library for the InternetData API.

The library helps you browse the databases your organization is licensed for, check what is in each build before you fetch it, and download and verify the files.

Getting Started

pip install internetdata

Requires Python 3.11 or newer. Type hints are included, and the package ships py.typed.

Usage

Every call needs an API key carrying the db.download scope. Create one in the console, then:

import os
from internetdata import InternetData

client = InternetData(os.environ["INTERNETDATA_API_KEY"])

for family in client.database.list():
    print(family.base, family.standing, [v.id for v in family.versions])

The client holds an HTTP connection pool, so use it as a context manager, or call client.close() when you are done with it:

with InternetData(api_key) as client:
    print(len(client.database.list()))

The catalog

list answers database FAMILIES. A licence is held against a family, while a download names a specific version, so the ids the other calls take come from each family's versions:

for family in client.database.list():
    if family.standing != "licensed":
        continue
    for version in family.versions:
        print(version.id, version.formats)   # 'bogon_ip_v1' ('csvgz', 'mmdb')

standing is licensed, expired or unlicensed, and license_type is what your licence lets you do with the data (evaluation, standard, redistribute, or None when there is no licence). A family you have never bought is still listed, as unlicensed, so you can see what else exists.

What is inside a build

metadata is cheap enough to poll. It answers when the build was generated, how many rows it has, its columns and a few real rows, and the size of each format in bytes, all without moving the file:

meta = client.database.metadata("bogon_ip_v1")

print(meta.updated)                  # datetime.date(2026, 9, 4)
print(meta.entries)                  # 1234
print(meta.size["csvgz"])            # 760
print([c.name for c in meta.schema["csvgz"]])

Checking size before a download is worth the round trip: the catalog spans a few hundred bytes to several gigabytes.

Downloading

Three ways, depending on what you want to do with the bytes:

url = client.database.download_url("bogon_ip_v1", "csvgz")
raw = client.database.download_bytes("bogon_ip_v1", "csvgz")
written = client.database.download("bogon_ip_v1", "mmdb", "./bogon_ip_v1.mmdb")

download_url hands back a time-limited link straight to object storage. It carries its own signature and none of your API key, so you can pass it to curl, a job runner or anything else that speaks HTTP. The link authorizes the START of a transfer, so one already running is not cut off when it lapses.

download streams to a file, so nothing larger than a chunk is ever held in memory. The bytes land in a neighboring .part file that is moved into place only once the whole transfer has arrived, so a failed refresh leaves the copy you already had untouched. download_bytes holds the whole file in memory, so reach for it only at the small end of the catalog.

Either way a short transfer fails rather than handing you a truncated file, and the key is never sent to object storage.

Verify what you fetched against the published digests:

import hashlib

digests = client.database.checksums("bogon_ip_v1", "csvgz")
assert hashlib.sha256(raw).hexdigest() == digests["sha256"]

Download history

downloads answers your organization's recent attempts, newest first, refusals included. A denial is what answers "it stopped working", and its absence answers nothing:

for attempt in client.database.downloads(limit=20):
    print(attempt.created, attempt.dataset_id, attempt.outcome, attempt.http_status)

Async

Everything above works the same way under asyncio, with AsyncInternetData:

import asyncio
from internetdata import AsyncInternetData

async def main():
    async with AsyncInternetData(api_key) as client:
        meta = await client.database.metadata("bogon_ip_v1")
        await client.database.download("bogon_ip_v1", "csvgz", "./bogon_ip_v1.csv.gz")
        print(meta.entries)

asyncio.run(main())

Errors

Failures raise an InternetDataError carrying a kind and a retryable flag:

from internetdata import InternetDataError

try:
    client.database.download_url("vpn_ip_v1", "mmdb")
except InternetDataError as err:
    print(err.kind, err.retryable, err.message)   # forbidden False NOT_LICENSED

kind is one of bad_request, unauthorized, forbidden, rate_limited, quota_exceeded, server_error or network. message is the API's own result code, passed through as it was sent, so you can switch on NOT_LICENSED against LICENSE_EXPIRED without reading the status.

Note that rate_limited and quota_exceeded both arrive as HTTP 429 and are not the same thing. A rate limit is the API facing a traffic burst, and retrying later works; a spent quota needs your allowance raised or the window to roll over. The library retries rate limits for you, and server and network failures, but never a spent quota or anything else you sent.

Other Libraries

There are official InternetData client libraries available for many languages including PHP, Python, Go, Java, Ruby, and many popular frameworks such as Django, Rails, and Laravel. See our GitHub at https://github.com/internetdata for more.

About InternetData

InternetData: IP and network intelligence databases, published as CSV and MMDB, licensed by contract and downloadable on demand.

InternetData

License

This project is licensed under the MIT License.

Metadata

Release files for internetdata 1.2.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 internetdata 1.2.2
File Size Uploaded
internetdata-1.2.2.tar.gz 45.8 kB Details

Built distribution (wheel)

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

Total release size: 96.8 kB

Release files / internetdata-1.2.2.tar.gz

Download URL internetdata-1.2.2.tar.gz
Size 45.8 kB
Tags Source
SHA-256 checksum
How to use checksums
45b35f8da3686d1c8defc711fffb87fdaa190336af3841dc6f0c96a1b7575ffe
BLAKE2b-256 checksum
How to use checksums
ab191db1fe40730075c3ae8d7589dd91ed0b6381cfaae08cb434e3634d5897dc
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 Sep 9, 2026.

Transparency log

Release files / internetdata-1.2.2-py3-none-any.whl

Download URL internetdata-1.2.2-py3-none-any.whl
Size 50.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2aa68bba5eec4a62f2beab862ee5d0e1c36054eac583839b6c8c72612a917697
BLAKE2b-256 checksum
How to use checksums
9142a967eabad6b55dcaa88639ec2f8dcbe98fcc7f5dedf7f70d7bda63cfe3b2
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 Sep 9, 2026.

Transparency log

Release history Release notifications | RSS feed

2.7.2

2 release files

2.7.1

2 release files

2.7.0

2 release files

2.6.2

2 release files

2.6.1

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

This release

1.2.2 This release

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

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