Trying to use whois in python but getting file not found error in windows

657 Views Asked by At

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

There are 1 best solutions below

2
SIGHUP On

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