Free IP geolocation API for Python — no API key, no signup.
A dependency-free Python client for HackMyIP: IP geolocation, VPN/proxy detection, DNS and WHOIS lookups, DNSBL blacklist checks and email breach checks.
Standard library only. No API key. No account. No rate-limit headers to babysit.
import hackmyip
me = hackmyip.my_ip()
print(me["ip"], me["location"]["country"])
google = hackmyip.lookup("8.8.8.8")
print(google["location"]["city"], google["network"]["org"])pip install hackmyipPython 3.8+. Zero dependencies — it uses urllib from the standard library.
Most IP geolocation APIs make you sign up, hold a key, and watch a quota. This one doesn't. You can curl it, script it, or run it in CI without provisioning anything. See the API docs for the raw REST endpoints.
Every method returns the response payload directly and raises HackMyIPError if the API reports a problem — you never unwrap {"success": ..., "data": ...} yourself.
hackmyip.my_ip() # your own IP, location, network, privacy score
hackmyip.lookup("8.8.8.8") # any IPv4 or IPv6 address
hackmyip.bulk(["8.8.8.8", "1.1.1.1"]) # up to 50 per requestresult = hackmyip.score("8.8.8.8")
print(result["privacy"]["grade"]) # A-D
print(result["privacy"]["label"]) # e.g. "datacenter"hackmyip.dns("example.com") # A records by default
hackmyip.dns("example.com", "MX") # or pick a type
hackmyip.whois("example.com")
hackmyip.rdns("8.8.8.8")hackmyip.blacklist("8.8.8.8") # DNSBL status across 10 lists
hackmyip.breach("someone@example.com") # known breach exposurehackmyip.down("https://example.com") # is_up, status_code, response timeUse Client directly for a different timeout or base URL:
from hackmyip import Client
client = Client(timeout=5.0)
client.lookup("1.1.1.1")from hackmyip import HackMyIPError
try:
hackmyip.lookup("not-an-ip")
except HackMyIPError as exc:
print(exc) # HTTP 400: Invalid IP address format.
print(exc.status) # 400HackMyIPError.status is the HTTP status when one was received, or None for network failures and malformed responses.
| Method | Endpoint | Returns |
|---|---|---|
my_ip() |
GET /api/ip |
Your IP, location, network, privacy score |
lookup(ip) |
GET /api/lookup |
Geolocation, ASN, ISP for any IP |
score(ip=None) |
GET /api/score |
Privacy grade, VPN/proxy/datacenter class |
breach(email) |
GET /api/breach |
Breach exposure for an email |
dns(domain, type=None) |
GET /api/dns |
DNS records |
whois(domain) |
GET /api/whois |
Registration data |
rdns(ip) |
GET /api/rdns |
Reverse DNS (PTR) |
blacklist(ip) |
GET /api/blacklist |
DNSBL listing status |
down(url) |
GET /api/down |
Uptime, status code, response time |
bulk(ips) |
POST /api/bulk |
Up to 50 IPs in one request |
Full REST reference and an OpenAPI 3.1 spec: hackmyip.com/api
- Node / CLI — hackmyip-js
- Terminal —
curl hackmyip.comworks with no install at all
MIT