In this video tutorial I will show you how to get domain name information from a domain using python.
To Get DOMAIN information:
PYTHON CODE:
import whois def get_whois_info(domain_name): domain_info = whois.whois(domain_name) expiration_date = domain_info.expiration_date last_updated = domain_info.last_updated registrar = domain_info.registrar creation_date = domain_info.creation_date # Convert expiration_date and creation_date to datetime if they are lists if isinstance(expiration_date, list): expiration_date = expiration_date[0] if isinstance(creation_date, list): creation_date = creation_date[0] return { 'expiration_date': expiration_date , '\n last_updated': last_updated, 'registrar': registrar, 'name': domain_name, 'creation_date': creation_date } # Example domain domain_name = 'rt.com' # Get WHOIS information domain_info = get_whois_info(domain_name) # Print the information print(domain_info)
I have already installed whois package in my project, pip install whois. But it is not working, I got the following error,
"attributeerror: module 'whois' has no attribute 'whois'"
SOLUTION:
I resolved the error by installing the package "python-whois"
pip install python-whois
VIDEO GUIDE:
Post your comments / questions
Recent Article
- Fix-Gradient effect turning to gray in after effects
- How to blur an image in python?
- ModuleNotFoundError: No module named 'whois' in Python GoviralHost Without Terminal
- How to Convert Image to Pencil Sketch in Python?
- AttributeError: module 'urllib' has no attribute 'request' - Python
- How to Extract audio from video files using python?
- PermissionError: [Errno 13] Permission denied: 'shampoo_sales.csv' - Python
- [WinError 145] The directory is not empty: 'FolderPath' - Python
Related Article