-1
import whois
site = input('enter site : ')
M = whois.whois(site)
print(M)

When I input, enter site : google.com

I got following response (error):

Traceback (most recent call last):
  File "f:/Programming/project/Project/whois.py", line 1, in <module>
    import whois
  File "f:\Programming\project\Project\whois.py", line 4, in <module>
    M = whois.whois(site)
TypeError: 'module' object is not callable
KV Prajapati
  • 93,659
  • 19
  • 148
  • 186

2 Answers2

1

try:

M = whois.query(site)
print(M.__dict__)

query is the method to get the site whois data

user107511
  • 772
  • 3
  • 23
1

Your file is called whois.py. When you import whois you are importing your file not the package you think you are. Running whois.whois(...) you are calling yourself as a function.

Rename your file and try again.

Holloway
  • 6,412
  • 1
  • 26
  • 33