1

I am trying to use whois but getting this error:

enter image description here

I have also installed https://learn.microsoft.com/en-us/sysinternals/downloads/whois and it is working fine in my cmd but when I try it with python it shows the above error.

enter image description here

I have installed both python-whois and whois using the below commands but still getting the same error.

pip install python-whois
pip install whois

Edit: whois.whois() is not working it shows the below error:

AttributeError: module 'whois' has no attribute 'whois'

So I used whois.query() instead

My Code and output: enter image description here

1 Answers1

1

If you have correctly installed python-whois into your Python runtime environment then, for example:

import whois

wd = whois.whois('google.com')

Then, for example:

print(*wd['domain_name'])

Output:

GOOGLE.COM google.com
DarkKnight
  • 19,739
  • 3
  • 6
  • 22
  • Actually, whois.whois('google.com') is not working it shows this error : AttributeError: module 'whois' has no attribute 'whois'. So I used whois.query() instead – Tushar Upadhayay Aug 21 '22 at 11:59
  • @TusharUpadhayay I think you have a file named whois.py in your current working directory which would conflict with your installation of whois-python. Rename it and try again – DarkKnight Aug 21 '22 at 18:43