Commit 5ab11d2a by William Tisäter

Add ASN lookup to readme

parent 504b0f4d
......@@ -23,6 +23,7 @@ You can easily install pygeoip with setuptools:
* City
* Organization
* ISP
* ASN
## Quick Documentation ##
......@@ -77,4 +78,10 @@ Create your GeoIP instance with appropriate access flag. `STANDARD` reads data f
>>> gi.org_by_name('cnn.com')
'Turner Broadcasting System'
### ASN lookup ###
>>> gi = pygeoip.GeoIP('/path/to/GeoIPASNum.dat')
>>> gi.org_by_name('cnn.com')
'AS5662 Turner Broadcasting'
For more information, [check out the full API documentation](http://packages.python.org/pygeoip).
pygeoip pygeoip-module.html
pygeoip.ENCODING pygeoip-module.html#ENCODING
pygeoip.time_zone_by_country_and_region pygeoip.timezone-module.html#time_zone_by_country_and_region
pygeoip.__package__ pygeoip-module.html#__package__
pygeoip.STANDARD pygeoip-module.html#STANDARD
......@@ -6,6 +7,7 @@ pygeoip.MMAP_CACHE pygeoip-module.html#MMAP_CACHE
pygeoip.MEMORY_CACHE pygeoip-module.html#MEMORY_CACHE
pygeoip.const pygeoip.const-module.html
pygeoip.const.GEOIP_STANDARD pygeoip.const-module.html#GEOIP_STANDARD
pygeoip.const.ENCODING pygeoip.const-module.html#ENCODING
pygeoip.const.COUNTRY_CODES3 pygeoip.const-module.html#COUNTRY_CODES3
pygeoip.const.PY3 pygeoip.const-module.html#PY3
pygeoip.const.IPV6_EDITIONS pygeoip.const-module.html#IPV6_EDITIONS
......
......@@ -123,7 +123,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Sat Sep 29 02:57:38 2012
Generated by Epydoc 3.0.1 on Sun Sep 30 13:48:03 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -256,7 +256,7 @@ page was last updated. </p>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Sat Sep 29 02:57:38 2012
Generated by Epydoc 3.0.1 on Sun Sep 30 13:48:03 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -63,7 +63,7 @@
B
<a href="#C">C</a>
<a href="#D">D</a>
E
<a href="#E">E</a>
<a href="#F">F</a>
<a href="#G">G</a>
H
......@@ -159,6 +159,19 @@
<tr><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td></tr>
</table>
</td></tr>
<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="E">E</a></h2></td>
<td valign="top">
<table class="link-index" width="100%" border="1">
<tr>
<td width="33%" class="link-index"><a href="pygeoip-module.html#ENCODING">ENCODING</a><br />
<span class="index-where">(in&nbsp;<a href="pygeoip-module.html">pygeoip</a>)</span></td>
<td width="33%" class="link-index"><a href="pygeoip.const-module.html#ENCODING">ENCODING</a><br />
<span class="index-where">(in&nbsp;<a href="pygeoip.const-module.html">pygeoip.const</a>)</span></td>
<td width="33%" class="link-index">&nbsp;</td>
</tr>
<tr><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td></tr>
</table>
</td></tr>
<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="F">F</a></h2></td>
<td valign="top">
<table class="link-index" width="100%" border="1">
......@@ -459,7 +472,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Sat Sep 29 02:57:38 2012
Generated by Epydoc 3.0.1 on Sun Sep 30 13:48:03 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -62,9 +62,9 @@
<ul class="nomargin-top">
<li> <strong class="uidlink"><a href="pygeoip-module.html">pygeoip</a></strong>: <em class="summary">Pure Python GeoIP API</em>
<ul>
<li> <strong class="uidlink"><a href="pygeoip.const-module.html">pygeoip.const</a></strong>: <em class="summary">Constants needed for parsing binary GeoIP databases.</em> </li>
<li> <strong class="uidlink"><a href="pygeoip.timezone-module.html">pygeoip.timezone</a></strong> </li>
<li> <strong class="uidlink"><a href="pygeoip.util-module.html">pygeoip.util</a></strong>: <em class="summary">Misc.</em> </li>
<li> <strong class="uidlink"><a href="pygeoip.const-module.html">pygeoip.const</a></strong>: <em class="summary">Constants needed for the binary parser.</em> </li>
<li> <strong class="uidlink"><a href="pygeoip.timezone-module.html">pygeoip.timezone</a></strong>: <em class="summary">Time zone functions.</em> </li>
<li> <strong class="uidlink"><a href="pygeoip.util-module.html">pygeoip.util</a></strong>: <em class="summary">Utility functions.</em> </li>
</ul>
</li>
</ul>
......@@ -99,7 +99,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Sat Sep 29 02:57:38 2012
Generated by Epydoc 3.0.1 on Sun Sep 30 13:48:03 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -61,24 +61,14 @@
<!-- ==================== PACKAGE DESCRIPTION ==================== -->
<h1 class="epydoc">Package pygeoip</h1><p class="nomargin-top"><span class="codelink"><a href="pygeoip-pysrc.html">source&nbsp;code</a></span></p>
<p>Pure Python GeoIP API</p>
<p>The API is based on <a href="http://www.maxmind.com/app/python"
target="_top">MaxMind's C-based Python API</a>, but the code itself is
based on the <a href="http://pear.php.net/package/Net_GeoIP/"
target="_top">pure PHP5 API</a> by Jim Winstead and Hans Lellelid.</p>
<p>It is mostly a drop-in replacement, except the <code>new</code> and
<code>open</code> methods are gone. You should instantiate the <a
href="pygeoip.GeoIP-class.html" class="link">GeoIP</a> class
yourself:</p>
<p><code>gi = GeoIP('/path/to/GeoIP.dat',
pygeoip.MEMORY_CACHE)</code></p>
<p>The API is based on MaxMind's C-based Python API, but the code itself
is ported from the Pure PHP GeoIP API by Jim Winstead and Hans
Lellelid.</p>
<hr />
<div class="fields"> <dl><dt>Authors:</dt>
<dd>
Jennifer Ennis &lt;zaylea at gmail dot com&gt;,
William Tis&#228;ter &lt;william@defunct.cc&gt;
</dd>
</dl>
<div class="fields"> <p><strong>Author:</strong>
Jennifer Ennis &lt;zaylea@gmail.com&gt;
</p>
<p><strong>License:</strong>
Copyright(C) 2004 MaxMind LLC
<p>This program is free software: you can redistribute it and/or
......@@ -112,9 +102,9 @@
</tr>
<tr><td class="summary">
<ul class="nomargin">
<li> <strong class="uidlink"><a href="pygeoip.const-module.html">pygeoip.const</a></strong>: <em class="summary">Constants needed for parsing binary GeoIP databases.</em> </li>
<li> <strong class="uidlink"><a href="pygeoip.timezone-module.html">pygeoip.timezone</a></strong> </li>
<li> <strong class="uidlink"><a href="pygeoip.util-module.html">pygeoip.util</a></strong>: <em class="summary">Misc.</em> </li>
<li> <strong class="uidlink"><a href="pygeoip.const-module.html">pygeoip.const</a></strong>: <em class="summary">Constants needed for the binary parser.</em> </li>
<li> <strong class="uidlink"><a href="pygeoip.timezone-module.html">pygeoip.timezone</a></strong>: <em class="summary">Time zone functions.</em> </li>
<li> <strong class="uidlink"><a href="pygeoip.util-module.html">pygeoip.util</a></strong>: <em class="summary">Utility functions.</em> </li>
</ul></td></tr>
</table>
......@@ -186,6 +176,13 @@
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="STANDARD"></a><span class="summary-name">STANDARD</span> = <code title="0">0</code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="MMAP_CACHE"></a><span class="summary-name">MMAP_CACHE</span> = <code title="8">8</code>
</td>
</tr>
......@@ -200,7 +197,7 @@
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="STANDARD"></a><span class="summary-name">STANDARD</span> = <code title="0">0</code>
<a name="ENCODING"></a><span class="summary-name">ENCODING</span> = <code title="'iso-8859-1'"><code class="variable-quote">'</code><code class="variable-string">iso-8859-1</code><code class="variable-quote">'</code></code>
</td>
</tr>
<tr>
......@@ -242,7 +239,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Sat Sep 29 02:57:38 2012
Generated by Epydoc 3.0.1 on Sun Sep 30 13:48:03 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -563,9 +563,9 @@ object --+
used and setup segment sizes and start points that will be used by the
seek*() methods later.</p>
<p>Supported databases:</p>
<p>* COUNTRY_EDITION * REGION_EDITION_REV0 * REGION_EDITION_REV1 *
CITY_EDITION_REV0 * CITY_EDITION_REV1 * ORG_EDITION * ISP_EDITION *
ASNUM_EDITION</p>
<p>* COUNTRY_EDITION * COUNTRY_EDITION_V6 * REGION_EDITION_REV0 *
REGION_EDITION_REV1 * CITY_EDITION_REV0 * CITY_EDITION_REV1 * ORG_EDITION
* ISP_EDITION * ASNUM_EDITION</p>
<dl class="fields">
</dl>
</td></tr></table>
......@@ -1065,7 +1065,7 @@ object --+
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Sat Sep 29 02:57:38 2012
Generated by Epydoc 3.0.1 on Sun Sep 30 13:48:03 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -167,7 +167,7 @@ object --+
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Sat Sep 29 02:57:38 2012
Generated by Epydoc 3.0.1 on Sun Sep 30 13:48:03 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -177,7 +177,7 @@ exceptions.BaseException --+
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Sat Sep 29 02:57:38 2012
Generated by Epydoc 3.0.1 on Sun Sep 30 13:48:03 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -337,7 +337,7 @@ object --+
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Sat Sep 29 02:57:38 2012
Generated by Epydoc 3.0.1 on Sun Sep 30 13:48:03 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -61,12 +61,12 @@
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module const</h1><p class="nomargin-top"><span class="codelink"><a href="pygeoip.const-pysrc.html">source&nbsp;code</a></span></p>
<p>Constants needed for parsing binary GeoIP databases. It is part of the
pygeoip package.</p>
<p>Constants needed for the binary parser. Part of the pygeoip
package.</p>
<hr />
<div class="fields"> <p><strong>Author:</strong>
Jennifer Ennis &lt;zaylea at gmail dot com&gt;
Jennifer Ennis &lt;zaylea@gmail.com&gt;
</p>
<p><strong>License:</strong>
Copyright(C) 2004 MaxMind LLC
......@@ -422,6 +422,13 @@
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="ENCODING"></a><span class="summary-name">ENCODING</span> = <code title="'iso-8859-1'"><code class="variable-quote">'</code><code class="variable-string">iso-8859-1</code><code class="variable-quote">'</code></code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<a name="__package__"></a><span class="summary-name">__package__</span> = <code title="'pygeoip'"><code class="variable-quote">'</code><code class="variable-string">pygeoip</code><code class="variable-quote">'</code></code>
</td>
</tr>
......@@ -580,7 +587,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Sat Sep 29 02:57:38 2012
Generated by Epydoc 3.0.1 on Sun Sep 30 13:48:03 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -61,7 +61,27 @@
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module timezone</h1><p class="nomargin-top"><span class="codelink"><a href="pygeoip.timezone-pysrc.html">source&nbsp;code</a></span></p>
<!-- ==================== FUNCTIONS ==================== -->
<p>Time zone functions. Part of the pygeoip package.</p>
<hr />
<div class="fields"> <p><strong>Author:</strong>
Jennifer Ennis &lt;zaylea@gmail.com&gt;
</p>
<p><strong>License:</strong>
Copyright(C) 2004 MaxMind LLC
<p>This program is free software: you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.</p>
<p>This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.</p>
<p>You should have received a copy of the GNU Lesser General Public
License along with this program. If not, see
&lt;http://www.gnu.org/licenses/lgpl.txt&gt;.</p>
</p>
</div><!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
......@@ -212,7 +232,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Sat Sep 29 02:57:38 2012
Generated by Epydoc 3.0.1 on Sun Sep 30 13:48:03 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -61,11 +61,11 @@
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module util</h1><p class="nomargin-top"><span class="codelink"><a href="pygeoip.util-pysrc.html">source&nbsp;code</a></span></p>
<p>Misc. utility functions. It is part of the pygeoip package.</p>
<p>Utility functions. Part of the pygeoip package.</p>
<hr />
<div class="fields"> <p><strong>Author:</strong>
Jennifer Ennis &lt;zaylea at gmail dot com&gt;
Jennifer Ennis &lt;zaylea@gmail.com&gt;
</p>
<p><strong>License:</strong>
Copyright(C) 2004 MaxMind LLC
......@@ -298,7 +298,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Sat Sep 29 02:57:38 2012
Generated by Epydoc 3.0.1 on Sun Sep 30 13:48:03 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
......
......@@ -23,7 +23,8 @@
>pygeoip.util.ip2long</a><br /> <a target="mainFrame" href="pygeoip.util-module.html#ip2long_v4"
>pygeoip.util.ip2long_v4</a><br /> <a target="mainFrame" href="pygeoip.util-module.html#ip2long_v6"
>pygeoip.util.ip2long_v6</a><br /> <h2 class="toc">All Variables</h2>
<a target="mainFrame" href="pygeoip-module.html#MEMORY_CACHE"
<a target="mainFrame" href="pygeoip-module.html#ENCODING"
>pygeoip.ENCODING</a><br /> <a target="mainFrame" href="pygeoip-module.html#MEMORY_CACHE"
>pygeoip.MEMORY_CACHE</a><br /> <a target="mainFrame" href="pygeoip-module.html#MMAP_CACHE"
>pygeoip.MMAP_CACHE</a><br /> <a target="mainFrame" href="pygeoip-module.html#STANDARD"
>pygeoip.STANDARD</a><br /> <a target="mainFrame" href="pygeoip-module.html#__package__"
......@@ -40,7 +41,8 @@
>pygeoip.const.COUNTRY_EDITION_V6</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#COUNTRY_NAMES"
>pygeoip.const.COUNTRY_NAMES</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#DATABASE_INFO_MAX_SIZE"
>pygeoip.const.DATABASE_INFO_MAX_SIZE</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#DMA_MAP"
>pygeoip.const.DMA_MAP</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#FIPS_RANGE"
>pygeoip.const.DMA_MAP</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#ENCODING"
>pygeoip.const.ENCODING</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#FIPS_RANGE"
>pygeoip.const.FIPS_RANGE</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#FULL_RECORD_LENGTH"
>pygeoip.const.FULL_RECORD_LENGTH</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#GEOIP_MEMORY_CACHE"
>pygeoip.const.GEOIP_MEMORY_CACHE</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#GEOIP_STANDARD"
......
......@@ -18,7 +18,8 @@
>GeoIPBase</a><br /> <a target="mainFrame" href="pygeoip.GeoIPError-class.html"
>GeoIPError</a><br /> <a target="mainFrame" href="pygeoip.GeoIPMetaclass-class.html"
>GeoIPMetaclass</a><br /> <h2 class="toc">Variables</h2>
<a target="mainFrame" href="pygeoip-module.html#MEMORY_CACHE"
<a target="mainFrame" href="pygeoip-module.html#ENCODING"
>ENCODING</a><br /> <a target="mainFrame" href="pygeoip-module.html#MEMORY_CACHE"
>MEMORY_CACHE</a><br /> <a target="mainFrame" href="pygeoip-module.html#MMAP_CACHE"
>MMAP_CACHE</a><br /> <a target="mainFrame" href="pygeoip-module.html#STANDARD"
>STANDARD</a><br /> <a target="mainFrame" href="pygeoip-module.html#__package__"
......
......@@ -26,7 +26,8 @@
>COUNTRY_EDITION_V6</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#COUNTRY_NAMES"
>COUNTRY_NAMES</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#DATABASE_INFO_MAX_SIZE"
>DATABASE_INFO_MAX_SIZE</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#DMA_MAP"
>DMA_MAP</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#FIPS_RANGE"
>DMA_MAP</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#ENCODING"
>ENCODING</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#FIPS_RANGE"
>FIPS_RANGE</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#FULL_RECORD_LENGTH"
>FULL_RECORD_LENGTH</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#GEOIP_MEMORY_CACHE"
>GEOIP_MEMORY_CACHE</a><br /> <a target="mainFrame" href="pygeoip.const-module.html#GEOIP_STANDARD"
......
......@@ -7,10 +7,8 @@ from tests.config import COUNTRY_DB_PATH
class TestGeoIPCacheMethods(unittest.TestCase):
def setUp(self):
self.us_hostname = 'google.com'
self.us_ip = '64.233.161.99'
self.us_code = 'US'
self.us_name = 'United States'
self.gi_mmap = pygeoip.GeoIP(COUNTRY_DB_PATH, MMAP_CACHE)
self.gi_memory = pygeoip.GeoIP(COUNTRY_DB_PATH, MEMORY_CACHE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment