Skip to main content

IPScanner Python SDK

Official Python client for the IPScanner API.

Install

pip install ipscanner-io

Requires Python 3.9 or later.

Quick start

import ipscanner

client = ipscanner.Client(api_key="pk_live_...")

result = client.ip.lookup("8.8.8.8")
print(result["networkClass"], result["purity"]["grade"])

The async client has the same methods:

import asyncio
import ipscanner


async def main():
    async with ipscanner.AsyncClient() as client:
        result = await client.ip.lookup("8.8.8.8")
        print(result["verdict"]["classification"])


asyncio.run(main())

Responses are plain dicts that keep the API's JSON key names. Their shapes are described as TypedDicts in ipscanner.types.

vpnProvider is the VPN brand (Mullvad, NordVPN, ...) when known, else None; provider is the network owner. On the Free plan premium fields such as purity, provider, vpnProvider and precise geo come back as None, listed in locked, with planRequired naming the plan that unlocks them.

Full API reference: https://ipscanner.io/api-documentation

Usage

IP

client.ip.lookup("8.8.8.8")  # IP, CIDR or hostname
client.ip.vpn("1.1.1.1")
client.ip.proxy("1.1.1.1")
client.ip.geo("2001:4860:4860::8888")
client.ip.asn("1.1.1.1")
client.ip.whois("example.com")
client.ip.history(limit=50, verdict="vpn")
client.ip.demo("1.1.1.1")  # no key needed
client.ip.myip()  # no key needed

vpn and proxy carry purity (the score breakdown) on paid plans; a locked answer has deductionCount instead.

Email

result = client.email.check("jane@outlok.com")
# result["status"] "risky", result["reason"] "typo", result["suggestion"] "jane@outlook.com"

Checks syntax, throwaway domains, whether the domain receives mail, typos of big webmail domains and role addresses. The mailbox itself is not probed. One request per address.

Bulk

client.bulk.check(["1.1.1.1", "8.8.8.8"])
client.bulk.check(input="1.1.1.1\n8.8.8.8:443")

for event in client.bulk.stream(["1.1.1.1", "8.8.8.8"]):
    if event["type"] == "result":
        print(event["ip"], event["verdict"])
    elif event["type"] == "done" and not event["complete"]:
        print("stopped early:", event["reason"])

bulk.stream reads the NDJSON response line by line. Every event has all fields, with missing ones set to their zero value. The done event also has complete, which is false when the run hit the quota or the server deadline. Fields locked by the plan are zero values too and are listed in locked. On AsyncClient use async for.

Agentscan

client.agentscan.check(
    "203.0.113.7",
    user_agent="Mozilla/5.0 ...",
    headers={"accept-language": "en-US"},
)
client.agentscan.batch([{"line": 1, "ip": "203.0.113.7", "user_agent": "GPTBot/1.0"}])
client.agentscan.verify("66.249.66.1", bot="googlebot")
client.agentscan.allowlist()
client.agentscan.self_check()

Edge

client.edge.check("203.0.113.7", site="site_...", user_agent="Mozilla/5.0 ...")

Sites

client.sites.policy("site_...")

Gate

result = client.gate.verify("gs_...", token, remote_ip="203.0.113.7", email=form_email)

email is optional. With it, result["email"] holds the check and its action, and result["action"] is the stricter of the network and email actions.

gate.verify sends no API key: the site secret is the credential. It is never retried.

Provenance

client.provenance.check("203.0.113.7", claimed_jurisdiction="EU")
client.provenance.verify()
client.provenance.verify_anchored()
client.provenance.chain(limit=100)
client.provenance.jurisdictions()
csv_text = client.provenance.export(from_="2026-01-01", to="2026-02-01")

Account

client.account.limits()
client.account.usage()

ASN directory

client.asn_directory.top(top=20, by="prefixes")
client.asn_directory.search("cloudflare", limit=5)
client.asn_directory.get("AS15169")

Crawlers

client.crawlers.list()

Errors

All errors inherit from ipscanner.IPScannerError.

Error When
APIError Any error response. Has status, code, message, details, body.
AuthenticationError 401 or 403
NotFoundError 404
RateLimitError 429. Adds reason, retry_after, reset_at, limit, usage, remaining, needed, plan, upgrade_url, rate_limit.
APIConnectionError The API could not be reached.
APITimeoutError The request timed out.
try:
    client.bulk.check(ips)
except ipscanner.RateLimitError as e:
    print(e.reason, e.retry_after, e.upgrade_url)
except ipscanner.APIError as e:
    print(e.status, e.code, e.message)

GET requests are retried up to max_retries times on connection errors and 502, 503 and 504 responses. POST requests and 429 responses are never retried.

Configuration

client = ipscanner.Client(
    api_key="pk_live_...",  # default: IPSCANNER_API_KEY
    base_url="https://ipscanner.io",  # default: IPSCANNER_API_URL or https://ipscanner.io
    timeout=30.0,
    max_retries=2,
    http_client=None,  # bring your own httpx.Client
)

Use the client as a context manager, or call client.close() when done.

Licence

MIT

Metadata

Release files for ipscanner-io 0.3.1

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

Source distribution (sdist)

Source distribution for ipscanner-io 0.3.1
File Size Uploaded Provenance Actions
ipscanner_io-0.3.1.tar.gz 38.2 kB Without provenance Details for ipscanner_io-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ipscanner-io 0.3.1
File Interpreter ABI Platform Actions
ipscanner_io-0.3.1-py3-none-any.whl Python 3 none any Details for ipscanner_io-0.3.1-py3-none-any.whl

Total release size: 55.4 kB

Release files / ipscanner_io-0.3.1.tar.gz

Download URL ipscanner_io-0.3.1.tar.gz
Size 38.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8726cdd81acdb07045fbbdfa3c42f0075e693f0507556d291ee941ca8df18b3f
BLAKE2b-256 checksum
How to use checksums
99167c2c252900ea245da60963409f2d3df717396722f26bdc1d9a4d0c4b16ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / ipscanner_io-0.3.1-py3-none-any.whl

Download URL ipscanner_io-0.3.1-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
068be862fc89879843eb5757a510816a1243ecb05e8df4b0f86e3d50e0688102
BLAKE2b-256 checksum
How to use checksums
d9fb20260bb95dbaeea49b998af4a54076239b7eb30d7629d2b20493c6489564
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for ipscanner-io 0.3.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files No provenance

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