Commit b8c67327 by William Tisäter

Update README.rst from README.md

parent 07890956
...@@ -4,7 +4,7 @@ Pure Python GeoIP API ...@@ -4,7 +4,7 @@ Pure Python GeoIP API
This library is based on `Maxmind's GeoIP C This library is based on `Maxmind's GeoIP C
API <https://github.com/maxmind/geoip-api-c>`__. API <https://github.com/maxmind/geoip-api-c>`__.
Tested with Python version 2.5, 2.6, 2.7, 3.2 and 3.3. Tested with Python version 2.6, 2.7, 3.2 and 3.3.
|Build Status| |Coverage Status| |Downloads| |Build Status| |Coverage Status| |Downloads|
...@@ -13,27 +13,10 @@ Installation ...@@ -13,27 +13,10 @@ Installation
You can easily install pygeoip from PyPi. You can easily install pygeoip from PyPi.
:: .. code:: bash
pip install pygeoip pip install pygeoip
Supported Databases
-------------------
::
* COUNTRY_EDITION
* COUNTRY_EDITION_V6
* REGION_EDITION_REV0
* REGION_EDITION_REV1
* CITY_EDITION_REV0
* CITY_EDITION_REV1
* CITY_EDITION_REV1_V6
* ORG_EDITION
* ISP_EDITION
* ASNUM_EDITION
* ASNUM_EDITION_V6
Issues and Contribution Issues and Contribution
----------------------- -----------------------
...@@ -51,34 +34,40 @@ reads data from disk when needed, ``MEMORY_CACHE`` loads database into ...@@ -51,34 +34,40 @@ reads data from disk when needed, ``MEMORY_CACHE`` loads database into
memory on instantiation and ``MMAP_CACHE`` loads database into memory memory on instantiation and ``MMAP_CACHE`` loads database into memory
using mmap. using mmap.
:: .. code:: python
import pygeoip >>> import pygeoip
gi4 = pygeoip.GeoIP('/path/to/GeoIP.dat', pygeoip.MEMORY_CACHE) >>> gi = pygeoip.GeoIP('/path/to/GeoIP.dat')
gi6 = pygeoip.GeoIP('/path/to/GeoIPv6.dat', pygeoip.MEMORY_CACHE) >>> gi.country_name_by_addr('64.233.161.99')
'United States'
Country Lookup Country Lookup
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
:: .. code:: python
>>> gi4.country_code_by_name('google.com') >>> gi = pygeoip.GeoIP('/path/to/GeoIP.dat')
>>> gi.country_code_by_name('google.com')
'US' 'US'
>>> gi4.country_code_by_addr('64.233.161.99') >>> gi.country_code_by_addr('64.233.161.99')
'US' 'US'
>>> gi4.country_name_by_addr('64.233.161.99') >>> gi.country_name_by_addr('64.233.161.99')
'United States' 'United States'
>>> gi6.country_code_by_name('google.com')
.. code:: python
>>> gi = pygeoip.GeoIP('/path/to/GeoIPv6.dat')
>>> gi.country_code_by_name('google.com')
'IE' 'IE'
>>> gi6.country_code_by_addr('2001:7fd::1') >>> gi.country_code_by_addr('2001:7fd::1')
'EU' 'EU'
>>> gi6.country_name_by_addr('2001:7fd::1') >>> gi.country_name_by_addr('2001:7fd::1')
'Europe' 'Europe'
Region Lookup Region Lookup
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
:: .. code:: python
>>> gi = pygeoip.GeoIP('/path/to/GeoIPRegion.dat') >>> gi = pygeoip.GeoIP('/path/to/GeoIPRegion.dat')
>>> gi.region_by_name('apple.com') >>> gi.region_by_name('apple.com')
...@@ -87,7 +76,7 @@ Region Lookup ...@@ -87,7 +76,7 @@ Region Lookup
City Lookup City Lookup
~~~~~~~~~~~ ~~~~~~~~~~~
:: .. code:: python
>>> gi = pygeoip.GeoIP('/path/to/GeoIPCity.dat') >>> gi = pygeoip.GeoIP('/path/to/GeoIPCity.dat')
>>> gi.record_by_addr('64.233.161.99') >>> gi.record_by_addr('64.233.161.99')
...@@ -112,7 +101,7 @@ City Lookup ...@@ -112,7 +101,7 @@ City Lookup
Organization Lookup Organization Lookup
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
:: .. code:: python
>>> gi = pygeoip.GeoIP('/path/to/GeoIPOrg.dat') >>> gi = pygeoip.GeoIP('/path/to/GeoIPOrg.dat')
>>> gi.org_by_name('dell.com') >>> gi.org_by_name('dell.com')
...@@ -121,25 +110,46 @@ Organization Lookup ...@@ -121,25 +110,46 @@ Organization Lookup
ISP Lookup ISP Lookup
~~~~~~~~~~ ~~~~~~~~~~
:: .. code:: python
>>> gi = pygeoip.GeoIP('/path/to/GeoIPISP.dat') >>> gi = pygeoip.GeoIP('/path/to/GeoIPISP.dat')
>>> gi.org_by_name('cnn.com') >>> gi.isp_by_name('cnn.com')
'Turner Broadcasting System' 'Turner Broadcasting System'
ASN Lookup ASN Lookup
~~~~~~~~~~ ~~~~~~~~~~
:: .. code:: python
>>> gi = pygeoip.GeoIP('/path/to/GeoIPASNum.dat') >>> gi = pygeoip.GeoIP('/path/to/GeoIPASNum.dat')
>>> gi.org_by_name('cnn.com') >>> gi.asn_by_name('cnn.com')
'AS5662 Turner Broadcasting' 'AS5662 Turner Broadcasting'
For more information, `check out the full API For more information, `check out the full API
documentation <http://packages.python.org/pygeoip>`__. documentation <http://packages.python.org/pygeoip>`__.
.. |Build Status| image:: https://travis-ci.org/appliedsec/pygeoip.png Supported Databases
-------------------
+----------------+--------+--------+-----------------------------------------------------------------------------------+
| Type | IPv4 | IPv6 | Details |
+================+========+========+===================================================================================+
| Country | ✓ | ✓ | `MaxMind Country product page <http://www.maxmind.com/en/country>`__ |
+----------------+--------+--------+-----------------------------------------------------------------------------------+
| City | ✓ | ✓ | `MaxMind City product page <http://www.maxmind.com/en/city>`__ |
+----------------+--------+--------+-----------------------------------------------------------------------------------+
| Organization | ✓ | | `MaxMind Organization product page <http://www.maxmind.com/en/organization>`__ |
+----------------+--------+--------+-----------------------------------------------------------------------------------+
| ISP | ✓ | | `MaxMind ISP product page <http://www.maxmind.com/en/isp>`__ |
+----------------+--------+--------+-----------------------------------------------------------------------------------+
| Region | ✓ | | `MaxMind Region product page <http://www.maxmind.com/en/geolocation_landing>`__ |
+----------------+--------+--------+-----------------------------------------------------------------------------------+
| ASN | ✓ | ✓ | `MaxMind ASN product page <http://dev.maxmind.com/geoip/legacy/geolite>`__ |
+----------------+--------+--------+-----------------------------------------------------------------------------------+
| Netspeed | ✓ | | `MaxMind Netspeed product page <http://www.maxmind.com/en/netspeed>`__ |
+----------------+--------+--------+-----------------------------------------------------------------------------------+
.. |Build Status| image:: https://api.travis-ci.org/appliedsec/pygeoip.png?branch=master
:target: https://travis-ci.org/appliedsec/pygeoip :target: https://travis-ci.org/appliedsec/pygeoip
.. |Coverage Status| image:: https://coveralls.io/repos/appliedsec/pygeoip/badge.png .. |Coverage Status| image:: https://coveralls.io/repos/appliedsec/pygeoip/badge.png
:target: https://coveralls.io/r/appliedsec/pygeoip :target: https://coveralls.io/r/appliedsec/pygeoip
......
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