Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pygeoip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pygeoip
Commits
b8c67327
Commit
b8c67327
authored
Feb 01, 2014
by
William Tisäter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update README.rst from README.md
parent
07890956
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
38 deletions
+48
-38
README.rst
+48
-38
No files found.
README.rst
View file @
b8c67327
...
...
@@ -4,7 +4,7 @@ Pure Python GeoIP API
This library is based on `Maxmind's GeoIP 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|
...
...
@@ -13,27 +13,10 @@ Installation
You can easily install pygeoip from PyPi.
::
.. code:: bash
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
-----------------------
...
...
@@ -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
using mmap.
::
.. code:: python
import pygeoip
gi4 = pygeoip.GeoIP('/path/to/GeoIP.dat', pygeoip.MEMORY_CACHE)
gi6 = pygeoip.GeoIP('/path/to/GeoIPv6.dat', pygeoip.MEMORY_CACHE)
>>> import pygeoip
>>> gi = pygeoip.GeoIP('/path/to/GeoIP.dat')
>>> gi.country_name_by_addr('64.233.161.99')
'United States'
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'
>>> gi
4
.country_code_by_addr('64.233.161.99')
>>> gi.country_code_by_addr('64.233.161.99')
'US'
>>> gi
4
.country_name_by_addr('64.233.161.99')
>>> gi.country_name_by_addr('64.233.161.99')
'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'
>>> gi
6
.country_code_by_addr('2001:7fd::1')
>>> gi.country_code_by_addr('2001:7fd::1')
'EU'
>>> gi
6
.country_name_by_addr('2001:7fd::1')
>>> gi.country_name_by_addr('2001:7fd::1')
'Europe'
Region Lookup
~~~~~~~~~~~~~
::
.. code:: python
>>> gi = pygeoip.GeoIP('/path/to/GeoIPRegion.dat')
>>> gi.region_by_name('apple.com')
...
...
@@ -87,7 +76,7 @@ Region Lookup
City Lookup
~~~~~~~~~~~
::
.. code:: python
>>> gi = pygeoip.GeoIP('/path/to/GeoIPCity.dat')
>>> gi.record_by_addr('64.233.161.99')
...
...
@@ -112,7 +101,7 @@ City Lookup
Organization Lookup
~~~~~~~~~~~~~~~~~~~
::
.. code:: python
>>> gi = pygeoip.GeoIP('/path/to/GeoIPOrg.dat')
>>> gi.org_by_name('dell.com')
...
...
@@ -121,25 +110,46 @@ Organization Lookup
ISP Lookup
~~~~~~~~~~
::
.. code:: python
>>> gi = pygeoip.GeoIP('/path/to/GeoIPISP.dat')
>>> gi.
org
_by_name('cnn.com')
>>> gi.
isp
_by_name('cnn.com')
'Turner Broadcasting System'
ASN Lookup
~~~~~~~~~~
::
.. code:: python
>>> gi = pygeoip.GeoIP('/path/to/GeoIPASNum.dat')
>>> gi.
org
_by_name('cnn.com')
>>> gi.
asn
_by_name('cnn.com')
'AS5662 Turner Broadcasting'
For more information, `check out the full API
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
.. |Coverage Status| image:: https://coveralls.io/repos/appliedsec/pygeoip/badge.png
:target: https://coveralls.io/r/appliedsec/pygeoip
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment