Commit c0a4d2a7 by William Tisäter

Merge pull request #32 from ioc32/master

Extended Ipv6 documentation
parents 31b53910 e0f988bc
...@@ -30,16 +30,23 @@ You can easily install pygeoip with setuptools: ...@@ -30,16 +30,23 @@ You can easily install pygeoip with setuptools:
Create your GeoIP instance with appropriate access flag. `STANDARD` reads data from disk when needed, `MEMORY_CACHE` loads database into memory on instantiation and `MMAP_CACHE` loads database into memory using mmap. Create your GeoIP instance with appropriate access flag. `STANDARD` reads data from disk when needed, `MEMORY_CACHE` loads database into memory on instantiation and `MMAP_CACHE` loads database into memory using mmap.
import pygeoip import pygeoip
gi = pygeoip.GeoIP('/path/to/GeoIP.dat', pygeoip.MEMORY_CACHE) gi4 = pygeoip.GeoIP('/path/to/GeoIP.dat', pygeoip.MEMORY_CACHE)
gi6 = pygeoip.GeoIP('/path/to/GeoIPv6.dat', pygeoip.MEMORY_CACHE)
### Country lookup ### ### Country lookup ###
>>> gi.country_code_by_name('google.com') >>> gi4.country_code_by_name('google.com')
'US' 'US'
>>> gi.country_code_by_addr('64.233.161.99') >>> gi4.country_code_by_addr('64.233.161.99')
'US' 'US'
>>> gi.country_name_by_addr('64.233.161.99') >>> gi4.country_name_by_addr('64.233.161.99')
'United States' 'United States'
>>> gi6.country_code_by_name('google.com')
'IE'
>>> gi6.country_code_by_addr('2001:7fd::1')
'EU'
>>> gi6.country_name_by_addr('2001:7fd::1')
'Europe'
### Region lookup ### ### Region lookup ###
......
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