Evg
Evg

Reputation: 3080

python whois for windows

I try to get whois in python. I use this http://code.google.com/p/pywhois/ but it run only in linux. Is it posible to run it on windows? currently i get errors (because internal linux command whois used)

Upvotes: 4

Views: 6467

Answers (2)

Alex Martelli
Alex Martelli

Reputation: 882681

On Windows just like on Linux, pywhois gives an error if the whois program is not installed. You could try this whois, for example.

The reason, of course, is in pywhois/init.py, line 11:

r = subprocess.Popen(['whois', domain], stdout=subprocess.PIPE)

Clearly this line needs to run some existing, installed whois command-line program (which accepts the domain to look up as a commandline argument), whatever OS it's running on.

Upvotes: 6

Guillaume Lebourgeois
Guillaume Lebourgeois

Reputation: 3873

You could use :

os.system("whois %s" % hostname)

Or use urllib to connect http://www.whois.net and scrap content.

Upvotes: 1

Related Questions