Official IP-Atlas API client — IP geolocation, ASN, VPN detection
Project description
ipatlas
Official Python client for the IP-Atlas API — IP geolocation, ASN lookup, VPN/proxy/Tor detection, batch lookup, and account management.
Install
pip install ipatlas
Requires Python 3.8+. Depends on requests.
Quickstart
Without an API key (free anonymous tier)
from ipatlas import IPAtlas
client = IPAtlas()
# Look up your own IP
me = client.lookup_self()
print(me["country"], me["org"])
# Look up a specific IP (anonymous is limited to 60 req/min)
result = client.lookup("8.8.8.8")
print(result["asn"], result["is_datacenter"])
With an API key
from ipatlas import IPAtlas
client = IPAtlas(api_key="ipa_live_...")
result = client.lookup("1.1.1.1")
print(result)
Batch lookup (up to 100 IPs)
from ipatlas import IPAtlas
client = IPAtlas(api_key="ipa_live_...")
batch = client.lookup_batch(["8.8.8.8", "1.1.1.1", "not-an-ip"])
for item in batch["results"]:
if "error" in item:
print(f"{item['ip']}: {item['error']}")
else:
print(item["ip"], item.get("country"), item.get("org"))
Responses come back in the same order as the input list. Each element is either a successful lookup dict or a per-IP error dict {"ip": ..., "error": "..."}. Request-level failures (auth, quota) raise IPAtlasError.
Account management
info = client.account()
print(f"Plan: {info['plan']}, used {info['monthly_used']}/{info['monthly_limit']} this month")
# Rotate the key (old one is revoked, new one returned once)
new = client.rotate_key()
print(new["api_key"])
Error handling
from ipatlas import IPAtlas, IPAtlasError
client = IPAtlas(api_key="ipa_live_...")
try:
result = client.lookup("not-an-ip")
except IPAtlasError as e:
print(f"API error {e.status_code}: {e.body}")
API
IPAtlas(api_key=None, base_url='https://api.ip-atlas.io')
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key |
str |
None |
API key sent as X-API-Key header |
base_url |
str |
https://api.ip-atlas.io |
Override the API base URL |
client.lookup(ip) -> dict
Returns geolocation + ASN + threat data for the given IPv4 or IPv6 address.
client.lookup_self() -> dict
Returns data for the caller's own IP address.
client.lookup_batch(ips) -> dict
Looks up up to 100 IPs in a single request. Returns {"results": [...]} where each element is in the same order as the input list.
client.account() -> dict
Returns the plan, key prefix, daily/monthly usage, and Stripe linkage for the bound API key.
client.rotate_key() -> dict
Revokes the current key and issues a replacement with the same plan. The new plaintext key is only returned once.
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ipatlas-0.1.0.tar.gz.
File metadata
- Download URL: ipatlas-0.1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40e1e75cc64b4c0fd8ece51591d26d598b2065244180b61f1b23050def289cd0
|
|
| MD5 |
389326d28144be1ef9841e31941bbfd0
|
|
| BLAKE2b-256 |
287f8d64fc754bcab84e6a331cba75bb097bfc73643c60771f1ac2b7e3ad4b42
|
File details
Details for the file ipatlas-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ipatlas-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06b3ca7148b981d7b926e8e6f1c3c27910dbb3cf225f43e2915d7674bff4cc3a
|
|
| MD5 |
6444005e74ac0f9c7a0510c0797c5ea5
|
|
| BLAKE2b-256 |
71a02df79128f818e98555472156e462fe2f9829b4856b104090194aa9f0fcba
|