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

12.7k Views Asked by At

I tried to execute this code:

import whois
w = whois.whois('webscraping.com')
print w

And I got the error above. Why?

2

There are 2 best solutions below

3
Erik Rydén On

Try this instead:

w = whois.query('webscraping.com')
1
Oleg S On

Wrong library, solution is to remove old one and install new :

pip uninstall whois 
pip install python-whois