<divclass="children"><h1>Using pythonwhois</h1><divclass="text"><ahref="index.html"><<backtoindex</a></div><divclass="text">This is a quick usage guide; pythonwhois is pretty simple.</div><divclass="toc"><h2>Table of contents</h2><ul><li><ahref="#pwhoisrawjsonfPATHDOMAIN">pwhois [--raw] [--json] [-f PATH] DOMAIN</a><spanclass="fixed">pwhois</span> is the WHOIS tool that is included with pythonwhois. It's really just a... </li><li><ahref="#pythonwhois_get_whoisdomainnormalized">pythonwhois.get_whois(domain[, normalized=[]])</a> Retrieves and parses WHOIS data for a specified domain. Raises `pythonwhois... </li><li><ahref="#pythonwhois_net_get_whois_rawdomainserverrfc3490Truenever_cutFalsewith_server_listFalse">pythonwhois.net.get_whois_raw(domain[, server="", rfc3490=True, never_cut=False, with_server_list=False])</a> Retrieves the raw WHOIS data for the specified domain, and returns it as a list... </li><li><ahref="#pythonwhois_net_get_root_serverdomain">pythonwhois.net.get_root_server(domain)</a> Looks up the appropriate root server for a TLD, and returns it as a string.... </li><li><ahref="#pythonwhois_parse_parse_raw_whoisraw_datanormalizednever_query_handlesTruehandle_server">pythonwhois.parse.parse_raw_whois(raw_data[, normalized, never_query_handles=True, handle_server=""])</a> Parses the specified raw WHOIS data. It's useful to call this method manually if... </li></ul></div><h2>Normalization</h2><divclass="text">Before you start, it's important to understand the normalization functionality in pythonwhois. Since some WHOIS servers return data in all-uppercase or all-lowercase, and some registrants simply use the incorrect case themselves, reading WHOIS data can be a bit unpleasant.</div><divclass="text">pythonwhois attempts to solve this problem by optionally 'normalizing' WHOIS data. Depending on the kind of field, the parser will try to create a readable and consistent version of the value. The <spanclass="fixed">pwhois</span> command-line utility uses normalization by default; when using the Python module it's disabled by default.</div><divclass="text">Normalization isn't perfect, and you shouldn't rely on it for technical purposes. It's intended for increasing human readability only. If you work with a lot of WHOIS data, it's recommended to turn off normalization or do your own post-processing.</div><h2>From the commandline</h2><divclass="definition"><aname="pwhoisrawjsonfPATHDOMAIN">pwhois [--raw] [--json] [-f PATH] DOMAIN <divclass="children"><divclass="text"><spanclass="fixed">pwhois</span> is the WHOIS tool that is included with pythonwhois. It's really just a script that you can run from your terminal, and that gives you nicely formatted WHOIS output. Normalization is turned on in <spanclass="fixed">pwhois</span> by default, so it will try to make the output more readable (by fixing capitalization and such).</div><divclass="example">Example: Using <spanclass="fixed">pwhois</span><divclass="children"><h7>Code:</h7><preclass="code">sh$ pwhois cryto.net</pre><h7>Output:</h7><preclass="output">Status : clientTransferProhibited
[...]</pre></div></div><divclass="text">There are several optional arguments that you can pass to <spanclass="fixed">pwhois</span> to make it behave differently.</div><dl><dt>--raw</dt><dd>When you use this flag, <spanclass="fixed">pwhois</span> will not attempt to parse the WHOIS data; it'll just follow redirects and output the raw data, delimited by double dashes (--).<divclass="children"></div></dd></dl><dl><dt>--json</dt><dd>This flag will make <spanclass="fixed">pwhois</span> output JSON instead of human-readable output. While not recommended, you can use this if you need parsed data in a non-Python application.<divclass="children"></div></dd></dl><dl><dt>-f PATH</dt><dd>This will make <spanclass="fixed">pwhois</span> read and parse WHOIS data from a specified file, instead of actually contacting a WHOIS server. Useful if you get your WHOIS data elsewhere.<divclass="children"></div></dd></dl><divclass="exclamation"><strong>Important:</strong> Note that when using <spanclass="fixed">-f PATH</span>, <spanclass="fixed">pwhois</span> will still expect a domain to be specified! What you enter here doesn't really matter, you can also just specify a single dot <spanclass="fixed">.</span> for the domain. <divclass="children"></div></div></div></a></div><h2>From your Python application</h2><divclass="text">To start using pythonwhois, use <spanclass="fixed">import pythonwhois</span>.</div><divclass="definition"><aname="pythonwhois_get_whoisdomainnormalized">pythonwhois.get_whois(<em>domain</em>[, <em>normalized=[]</em>]) <divclass="children"><divclass="text">Retrieves and parses WHOIS data for a specified domain. Raises <spanclass="fixed">pythonwhois.shared.WhoisException</span> if no root server for the TLD could be found.</div><h3>Arguments</h3><dl><dt>domain</dt><dd>The domain to WHOIS.<divclass="children"></div></dd></dl><dl><dt>normalized</dt><dd><em>Optional.</em> What data to normalize. By default, no data will be normalized. You can specify either a list of keys to normalize (see also the result reference below), an empty list (to turn off normalization), or <spanclass="fixed">True</span> (to turn on normalization for all supported fields).<divclass="children"></div></dd></dl><h3>Returns</h3><divclass="text">A nested structured object, consisting of dicts and lists. The only key that is always present is <spanclass="fixed">contacts</span>, but the keys inside the dict that it contains may not be.</div><divclass="text">All lists are deduplicated where necessary; each item in a list is guaranteed unique. If this is not the case, that's a bug and you should <ahref="https://github.com/joepie91/python-whois/issues/new">report</a> it :)</div><dl><dt>id</dt><dd>The Domain ID.<divclass="children"></div></dd></dl><dl><dt>status</dt><dd>A list of current statuses of the domain at the registrar. May contain any string value.<divclass="children"></div></dd></dl><dl><dt>creation_date</dt><dd>A list of <spanclass="fixed">datetime.datetime</span> objects representing the creation date(s) of the domain.<divclass="children"></div></dd></dl><dl><dt>expiration_date</dt><dd>A list of <spanclass="fixed">datetime.datetime</span> objects representing the expiration date(s) of the domain.<divclass="children"></div></dd></dl><dl><dt>updated_date</dt><dd>A list of <spanclass="fixed">datetime.datetime</span> objects representing the update date(s) of the domain. Note that what an 'update date' entails, differs between WHOIS servers. For some, it means the last renewal data. For others, it means the last registrant info update. For yet others, it means the last update of their WHOIS database as a whole. This key is unlikely to be useful, unless you're trying to plot WHOIS data changes over time.<divclass="children"></div></dd></dl><dl><dt>registrar</dt><dd>A list of registrar names. May contain any string value.<divclass="children"></div></dd></dl><dl><dt>whois_server</dt><dd>A list of WHOIS servers refered to. This is unlikely to be a useful list.<divclass="children"></div></dd></dl><dl><dt>nameservers</dt>