Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hackmyip-python

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

Install

pip install hackmyip

Python 3.8+. Zero dependencies — it uses urllib from the standard library.

Why no API key

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.

Usage

Every method returns the response payload directly and raises HackMyIPError if the API reports a problem — you never unwrap {"success": ..., "data": ...} yourself.

IP geolocation

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 request

VPN / proxy / datacenter detection

result = hackmyip.score("8.8.8.8")
print(result["privacy"]["grade"])   # A-D
print(result["privacy"]["label"])   # e.g. "datacenter"

DNS, WHOIS, reverse DNS

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

Blacklist and breach checks

hackmyip.blacklist("8.8.8.8")          # DNSBL status across 10 lists
hackmyip.breach("someone@example.com") # known breach exposure

Uptime check

hackmyip.down("https://example.com")   # is_up, status_code, response time

Custom client

Use Client directly for a different timeout or base URL:

from hackmyip import Client

client = Client(timeout=5.0)
client.lookup("1.1.1.1")

Error handling

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)   # 400

HackMyIPError.status is the HTTP status when one was received, or None for network failures and malformed responses.

Endpoints

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

Other clients

  • Node / CLIhackmyip-js
  • Terminalcurl hackmyip.com works with no install at all

License

MIT

About

Free IP geolocation API for Python — no API key, no signup. VPN/proxy detection, DNS, WHOIS, blacklist and email breach checks. Zero dependencies.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages