You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

201 lines
18 KiB
HTML

11 years ago
<!doctype html>
<html>
<head>
<style>
body {
background-color: #F5F5F5;
font-family: sans-serif;
margin-right: 40px;
}
h2, h3, h4, h5, h6, h7
{
margin-top: 16px;
margin-bottom: 4px;
}
.children { padding-left: 40px; }
.definition
{
font-weight: bold;
margin-bottom: 32px;
}
.example , .section
11 years ago
{
padding: 5px 6px;
font-weight: bold;
margin-top: 11px;
}
.example
{
11 years ago
font-size: 15px;
background-color: #E6E6E6;
}
.section
{
background-color: #E8E8E8;
}
.section > .title
{
font-size: 16px;
11 years ago
}
.example > .children, .section > .children
11 years ago
{
padding-top: 11px;
padding-left: 10px;
}
.section > .children
{
font-size: 95%;
}
.section > .children > div.text:first-child, .section > .children > dl:first-child
{
margin-top: 0px;
}
11 years ago
.example > .children > h7
{
font-size: 13px;
}
h7
{
font-size: 14px;
font-weight: bold;
margin-bottom: 2px;
}
pre
{
margin-top: 0px;
padding: 6px 7px;
background-color: #D9D9D9;
font-weight: normal;
font-size: 13px;
}
dl
{
margin: 5px 0px;
}
dt
{
font-weight: bold;
}
dd
{
font-size: 14px;
font-weight: normal;
margin-left: 8px;
}
dd > .children
{
font-size: 95%;
}
dd > .children > dl > dd
{
margin-left: 13px;
}
.exclamation
{
padding: 7px 8px;
margin: 11px 0px;
background-color: #FFE9AA;
border: 1px solid yellow;
font-size: 15px;
font-weight: normal;
}
.text
{
font-size: 15px;
font-weight: normal;
margin-bottom: 14px;
margin-top: 10px;
}
.toc
{
border: 1px solid gray;
background-color: #E6E6E6;
padding: 8px 9px;
font-size: 15px;
margin-bottom: 12px;
}
.toc h2
{
margin: 0px 0px 3px 0px;
font-size: 19px;
}
.toc ul
{
margin-top: 0px;
margin-bottom: 0px;
padding-left: 25px;
}
.toc li
{
margin-bottom: 2px;
}
.toc .alternatives
{
font-size: 12px;
}
.toc a
{
color: #292722;
}
.toc a:hover
{
color: black;
}
.fixed
{
font-family: monospace;
background-color: white;
padding: 1px 4px;
border: 1px solid silver;
border-radius: 4px;
}
</style>
</head>
<body>
<div class="children"><h1>Using pythonwhois</h1><div class="text"><a href="index.html"><< back to index</a></div><div class="text">This is a quick usage guide; pythonwhois is pretty simple.</div><div class="toc"><h2>Table of contents</h2><ul><li><a href="#pwhoisrawjsonfPATHDOMAIN">pwhois [--raw] [--json] [-f PATH] DOMAIN</a> <span class="fixed">pwhois</span> is the WHOIS tool that is included with pythonwhois. It's really just a... </li><li><a href="#pythonwhois_get_whoisdomainnormalized">pythonwhois.get_whois(domain[, normalized=[]])</a> Retrieves and parses WHOIS data for a specified domain. Raises `pythonwhois... </li><li><a href="#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><a href="#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><a href="#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><div class="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><div class="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 <span class="fixed">pwhois</span> command-line utility uses normalization by default; when using the Python module it's disabled by default.</div><div class="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><div class="definition"><a name="pwhoisrawjsonfPATHDOMAIN">pwhois [--raw] [--json] [-f PATH] DOMAIN <div class="children"><div class="text"><span class="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 <span class="fixed">pwhois</span> by default, so it will try to make the output more readable (by fixing capitalization and such).</div><div class="example">Example: Using <span class="fixed">pwhois</span> <div class="children"><h7>Code:</h7><pre class="code">sh$ pwhois cryto.net</pre><h7>Output:</h7><pre class="output">Status : clientTransferProhibited
11 years ago
Registrar : Internet.bs Corp.
Registration date : 2010-02-14 00:00:00
Expiration date : 2014-02-14 00:00:00
Last update : 2013-02-11 00:00:00
Name server : ns1.he.net
Name server : ns2.he.net
Name server : ns3.he.net
Name server : ns4.he.net
Name server : ns5.he.net
Registrant
Name : Sven Slootweg
Street address : Wijnstraat 211
Postal code : 3311BV
[...]</pre></div></div><div class="text">There are several optional arguments that you can pass to <span class="fixed">pwhois</span> to make it behave differently.</div><dl><dt>--raw</dt><dd>When you use this flag, <span class="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 (--).<div class="children"></div></dd></dl><dl><dt>--json</dt><dd>This flag will make <span class="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.<div class="children"></div></dd></dl><dl><dt>-f PATH</dt><dd>This will make <span class="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.<div class="children"></div></dd></dl><div class="exclamation"><strong>Important:</strong> Note that when using <span class="fixed">-f PATH</span>, <span class="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 <span class="fixed">.</span> for the domain. <div class="children"></div></div></div></a></div><h2>From your Python application</h2><div class="text">To start using pythonwhois, use <span class="fixed">import pythonwhois</span>.</div><div class="definition"><a name="pythonwhois_get_whoisdomainnormalized">pythonwhois.get_whois(<em>domain</em>[, <em>normalized=[]</em>]) <div class="children"><div class="text">Retrieves and parses WHOIS data for a specified domain. Raises <span class="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.<div class="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 <span class="fixed">True</span> (to turn on normalization for all supported fields).<div class="children"></div></dd></dl><h3>Returns</h3><div class="text">A nested structured object, consisting of dicts and lists. The only key that is always present is <span class="fixed">contacts</span>, but the keys inside the dict that it contains may not be.</div><div class="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 <a href="https://github.com/joepie91/python-whois/issues/new">report</a> it :)</div><dl><dt>id</dt><dd>The Domain ID.<div class="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.<div class="children"></div></dd></dl><dl><dt>creation_date</dt><dd>A list of <span class="fixed">datetime.datetime</span> objects representing the creation date(s) of the domain.<div class="children"></div></dd></dl><dl><dt>expiration_date</dt><dd>A list of <span class="fixed">datetime.datetime</span> objects representing the expiration date(s) of the domain.<div class="children"></div></dd></dl><dl><dt>updated_date</dt><dd>A list of <span class="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.<div class="children"></div></dd></dl><dl><dt>registrar</dt><dd>A list of registrar names. May contain any string value.<div class="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.<div class="children"></div></dd></dl><dl><dt>nameservers</dt>
11 years ago
</body>
</html>