A Python CLI tool that looks up domain registration information. View registrar, dates, nameservers, and contact details.
This tutorial requires an APIVerve API key. Sign up free - no credit card required.
- Look up WHOIS data for any domain
- View registrar information
- See creation and expiry dates
- View nameservers
- See domain status codes
- Contact information (when available)
- Interactive mode or command-line arguments
-
Clone this repository
git clone https://github.com/apiverve/whois-lookup-python-tutorial.git cd whois-lookup-python-tutorial -
Install dependencies
pip install -r requirements.txt
-
Add your API key
Open
lookup.pyand replace the API key:API_KEY = 'your-api-key-here'
-
Run the tool
Interactive mode:
python lookup.py
Command line mode:
python lookup.py github.com
$ python lookup.py github.com
=======================================================
WHOIS Lookup: github.com
=======================================================
Registrar Information
---------------------------------------------------
Registrar: MarkMonitor Inc.
Created: 2007-10-09
Expires: 2026-10-09
Updated: 2024-09-08
Domain Status
---------------------------------------------------
clientDeleteProhibited
clientTransferProhibited
clientUpdateProhibited
Nameservers
---------------------------------------------------
dns1.p08.nsone.net
dns2.p08.nsone.net
dns3.p08.nsone.net
dns4.p08.nsone.net
ns-1283.awsdns-32.org
ns-1707.awsdns-21.co.uk
ns-421.awsdns-52.com
ns-520.awsdns-01.net
=======================================================whois-lookup-python-tutorial/
├── lookup.py # Main Python script
├── requirements.txt # Dependencies (requests)
├── screenshot.jpg # Preview image
├── LICENSE # MIT license
├── .gitignore # Git ignore rules
└── README.md # This file
- User provides a domain name
- Script cleans and validates the input
- API queries WHOIS database
- Script formats and displays results
response = requests.get(
'https://api.apiverve.com/v1/whoislookup',
params={'domain': domain},
headers={'x-api-key': API_KEY}
)Endpoint: GET https://api.apiverve.com/v1/whoislookup
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
domain |
string | Yes | Domain to look up (e.g., "google.com") |
Example Response:
{
"status": "ok",
"error": null,
"data": {
"domainName": "MYSPACE.COM",
"registrar": "GoDaddy.com, LLC",
"createdDate": "1996-02-22T05:00:00Z",
"expiryDate": "2029-02-23T05:00:00Z",
"updatedDate": "2023-01-17T00:16:21Z",
"domainStatus": [
"client delete prohibited",
"client transfer prohibited"
],
"nameServers": [
"ns-cloud-a1.googledomains.com",
"ns-cloud-a2.googledomains.com"
],
"registrarURL": "http://www.godaddy.com"
}
}- Domain research - Check who owns a domain
- Due diligence - Verify domain ownership
- Expiry tracking - Monitor domain expiration
- Brand protection - Find infringing domains
- Security investigation - Research suspicious domains
- Sales prospecting - Find domain contact info
- Add domain expiry alerts
- Monitor multiple domains from a list
- Save results to CSV/JSON
- Build a web interface
- Compare WHOIS history over time
- Integrate with CRM systems
Explore more APIs at APIVerve:
- Domain Availability - Check if a domain is available
- DNS Lookup - Check DNS records
- SSL Checker - Check SSL certificates
This tutorial works with the free APIVerve plan. Some APIs may have:
- Locked fields: Premium response fields return
nullon free plans - Ignored parameters: Some optional parameters require a paid plan
The API response includes a premium object when limitations apply. Upgrade anytime to unlock all features.
MIT - see LICENSE
- Get API Key - Sign up free
- APIVerve Marketplace - Browse 300+ APIs
- WHOIS Lookup API - API details
