whoisit
raw JSON → 4.0.3 verified Fri May 01 auth: no python
A Python client for RDAP WHOIS-like services for internet resources (domains, IPs, ASNs). The current version is 4.0.3, requires Python >=3.10. Releases occur irregularly, with several bug fixes and feature updates per year.
pip install whoisit Common errors
error AttributeError: module 'whoisit' has no attribute 'domain' ↓
cause The namespace changed in v3.x; you must call `whoisit.bootstrap()` first or import incorrectly.
fix
Call
whoisit.bootstrap() before using whoisit.domain(). The functions are attached after bootstrap. error whoisit.errors.NotBootstrappedError: Bootstrap not completed. ↓
cause You forgot to call `whoisit.bootstrap()` before querying.
fix
Add
whoisit.bootstrap() once at the start of your program. error json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) ↓
cause The RDAP server returned an HTML error page, often due to a bad URL or network issue.
fix
Ensure the resource name is valid and you have internet connectivity. You can also set a user-agent via
whoisit.set_user_agent('...'). error TypeError: Object of type 'set' is not JSON serializable ↓
cause Some parsed data (e.g., email addresses) are returned as sets instead of lists, causing serialization errors.
fix
Convert sets to lists manually:
result['emails'] = list(result.get('emails', [])) before JSON serialization. Warnings
breaking In v4.0.0, the library dropped Python 3.9 support. Requires Python >=3.10. ↓
fix Upgrade Python to 3.10+ or pin to whoisit<4.0.0 if stuck on 3.9.
breaking The function `whoisit.bootstrap()` must be called before any queries. Otherwise, queries will fail with a `NotBootstrappedError`. ↓
fix Call `whoisit.bootstrap()` at the start of your application, optionally with a bootstrap URL argument.
gotcha The `whoisit.domain()` function will follow RDAP redirects automatically, but it may take several seconds for some TLDs (e.g., .us). The default timeout may cause delays. ↓
fix Set a custom timeout via `whoisit.set_default_timeout(seconds)` before queries.
deprecated In v3.x, the `whoisit.errors` module was restructured. Direct attribute access like `whoisit.errors.RDAPError` may break; import explicitly instead. ↓
fix Use `from whoisit import errors` and then `errors.RDAPError`.
Imports
- whoisit
import whoisit - RDAPError wrong
import whoisit.errorscorrectfrom whoisit import errors
Quickstart
import whoisit
# Bootstrap the RDAP servers (required once, e.g., at app start)
whoisit.bootstrap()
# Query a domain
result = whoisit.domain('example.com')
print(result.get('handle'))
print(result.get('name'))
# Query an IP
ip_result = whoisit.ip('8.8.8.8')
print(ip_result.get('handle'))
# Query an ASN
asn_result = whoisit.asn('15169')
print(asn_result.get('handle'))