What Python way would you suggest to check whois database records?
<p>I'm trying to get a webservice up and running that actually requires to check whois databases. What I'm doing right now is ugly and I'd like to avoid it as much as I can: I call gwhois command and parse its output. Ugly.</p>

<p>I did some search to try to find a pythonic way to do this task. Generally I got quite much nothing - <a href="http://mail.python.org/pipermail/python-list/2000-March/028122.html">this old discussion list link</a> has a way to check if domain exist. Quite not what I was looking for... But still, it was best anwser Google gave me - everything else is just a bunch of unanwsered questions.</p>

<p>Any of you have succeeded to get some method up and running? I'd very much appreciate some tips, or should I just do it the opensource-way, sit down and code something by myself? :) </p>

<p>Look at this:
<a href="http://code.google.com/p/pywhois/">http://code.google.com/p/pywhois/</a></p>

<p>pywhois - Python module for retrieving WHOIS information of domains</p>

<p>Goal:
- Create a simple importable Python module which will produce parsed WHOIS data for a given domain.
- Able to extract data for all the popular TLDs (com, org, net, ...)
- Query a WHOIS server directly instead of going through an intermediate web service like many others do.
- Works with Python 2.4+ and no external dependencies</p>

<p>Example:</p>

<pre><code>&gt;&gt;&gt; import pywhois
&gt;&gt;&gt; w = pywhois.whois('google.com')
&gt;&gt;&gt; w.expiration_date
['14-sep-2011']
&gt;&gt;&gt; w.emails
['contact-admin@google.com',
 'dns-admin@google.com',
 'dns-admin@google.com',
 'dns-admin@google.com']
&gt;&gt;&gt; print w
...
</code></pre>
