Python: How to use whois() with example

Syntax

whois.whois(domain_name)

whois() Example

# Import module
import whois

# Domain
domain = 'pytutorial.com'

# Get Information of the domain
get_info = whois.whois(domain)

# Print the information
print(get_info)

Output:

{
  "domain_name": "PYTUTORIAL.COM",
  "registrar": "NameCheap, Inc.",
  "whois_server": "whois.namecheap.com",
  "referral_url": null,
  "updated_date": "2020-12-23 14:56:23",
  "creation_date": "2019-12-09 21:13:10",
  "expiration_date": "2021-12-09 21:13:10",
  "name_servers": [
    "CHINCHILLA.EZOICNS.COM",
    "CUTTLEFISH.EZOICNS.COM",
    "ORANG-UTAN.EZOICNS.COM",
    "TROPICBIRD.EZOICNS.COM"
  ],
  "status": "clientTransferProhibited https://icann.org/epp#clientTransferProhibited",
  "emails": "[email protected]",
  "dnssec": "unsigned",
  "name": null,
  "org": null,
  "address": null,
  "city": null,
  "state": null,
  "zipcode": null,
  "country": null
}