Commit b19f30b8 by William Tisäter

Update README documentation

parent c261935e
......@@ -40,27 +40,41 @@ Create your GeoIP instance with appropriate access flag. `STANDARD` reads data f
>>> gi.country_name_by_addr('64.233.161.99')
'United States'
### Region lookup ###
>>> gi = pygeoip.GeoIP('/path/to/GeoIPRegion.dat')
>>> gi.region_by_name('apple.com')
{'region_name': 'CA', 'country_code': 'US'}
### City lookup ###
>>> gic = pygeoip.GeoIP('/path/to/GeoIPCity.dat')
>>> gic.record_by_addr('64.233.161.99')
>>> gi = pygeoip.GeoIP('/path/to/GeoIPCity.dat')
>>> gi.record_by_addr('64.233.161.99')
{
'city': 'Mountain View',
'region_name': 'CA',
'area_code': 650,
'longitude': -122.0574,
'country_code3': 'USA',
'latitude': 37.419199999999989,
'postal_code': '94043',
'dma_code': 807,
'country_code': 'US',
'country_name': 'United States'
'city': 'Mountain View',
'region_name': 'CA',
'area_code': 650,
'longitude': -122.0574,
'country_code3': 'USA',
'latitude': 37.419199999999989,
'postal_code': '94043',
'dma_code': 807,
'country_code': 'US',
'country_name': 'United States'
}
>>> gi.time_zone_by_addr('64.233.161.99')
'America/Los_Angeles'
### Timezone lookup ###
### Organization lookup ###
>>> gic = pygeoip.GeoIP('/path/to/GeoIPCity.dat')
>>> gic.time_zone_by_addr('64.233.161.99')
'America/Los_Angeles'
>>> gi = pygeoip.GeoIP('/path/to/GeoIPOrg.dat')
>>> gi.org_by_name('dell.com')
'Dell Computer Corporation'
### ISP lookup ###
>>> gi = pygeoip.GeoIP('/path/to/GeoIPISP.dat')
>>> gi.org_by_name('cnn.com')
'Turner Broadcasting System'
For more information, [check out the full API documentation](http://packages.python.org/pygeoip).
......@@ -2,21 +2,12 @@
"""
Pure Python GeoIP API
The API is based on U{MaxMind's C-based Python
API<http://www.maxmind.com/app/python>}, but the code itself is based on
the U{pure PHP5 API<http://pear.php.net/package/Net_GeoIP/>} by Jim Winstead
and Hans Lellelid.
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.
It is mostly a drop-in replacement, except the C{new} and C{open} methods
are gone. You should instantiate the L{GeoIP} class yourself:
@author: Jennifer Ennis <zaylea@gmail.com>
C{gi = GeoIP('/path/to/GeoIP.dat', pygeoip.MEMORY_CACHE)}
@author: Jennifer Ennis <zaylea at gmail dot com>
@author: William Tisäter <william@defunct.cc>
@license:
Copyright(C) 2004 MaxMind LLC
@license: Copyright(C) 2004 MaxMind LLC
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
......
# -*- coding: utf-8 -*-
"""
Constants needed for parsing binary GeoIP databases. It is part of the pygeoip
package.
Constants needed for the binary parser. Part of the pygeoip package.
@author: Jennifer Ennis <zaylea at gmail dot com>
@author: Jennifer Ennis <zaylea@gmail.com>
@license:
Copyright(C) 2004 MaxMind LLC
@license: Copyright(C) 2004 MaxMind LLC
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
......
# -*- coding: utf-8 -*-
"""
Time zone functions. Part of the pygeoip package.
@author: Jennifer Ennis <zaylea@gmail.com>
@license: Copyright(C) 2004 MaxMind LLC
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.
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.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/lgpl.txt>.
"""
__all__ = ['time_zone_by_country_and_region']
_country = {}
......
# -*- coding: utf-8 -*-
"""
Misc. utility functions. It is part of the pygeoip package.
Utility functions. Part of the pygeoip package.
@author: Jennifer Ennis <zaylea at gmail dot com>
@author: Jennifer Ennis <zaylea@gmail.com>
@license:
Copyright(C) 2004 MaxMind LLC
@license: Copyright(C) 2004 MaxMind LLC
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
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup file for pygeoip package.
......@@ -32,6 +33,8 @@ setup(name='pygeoip',
description='Pure Python GeoIP API',
author='Jennifer Ennis',
author_email='zaylea@gmail.com',
maintainer='William Tisäter',
maintainer_email='william@defunct.cc',
url='https://github.com/appliedsec/pygeoip',
classifiers=['Programming Language :: Python',
'Programming Language :: Python :: 2.5',
......
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