Commit b19f30b8 by William Tisäter

Update README documentation

parent c261935e
...@@ -40,10 +40,16 @@ Create your GeoIP instance with appropriate access flag. `STANDARD` reads data f ...@@ -40,10 +40,16 @@ Create your GeoIP instance with appropriate access flag. `STANDARD` reads data f
>>> gi.country_name_by_addr('64.233.161.99') >>> gi.country_name_by_addr('64.233.161.99')
'United States' '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 ### ### City lookup ###
>>> gic = pygeoip.GeoIP('/path/to/GeoIPCity.dat') >>> gi = pygeoip.GeoIP('/path/to/GeoIPCity.dat')
>>> gic.record_by_addr('64.233.161.99') >>> gi.record_by_addr('64.233.161.99')
{ {
'city': 'Mountain View', 'city': 'Mountain View',
'region_name': 'CA', 'region_name': 'CA',
...@@ -56,11 +62,19 @@ Create your GeoIP instance with appropriate access flag. `STANDARD` reads data f ...@@ -56,11 +62,19 @@ Create your GeoIP instance with appropriate access flag. `STANDARD` reads data f
'country_code': 'US', 'country_code': 'US',
'country_name': 'United States' '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') >>> gi = pygeoip.GeoIP('/path/to/GeoIPOrg.dat')
>>> gic.time_zone_by_addr('64.233.161.99') >>> gi.org_by_name('dell.com')
'America/Los_Angeles' '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). For more information, [check out the full API documentation](http://packages.python.org/pygeoip).
...@@ -2,21 +2,12 @@ ...@@ -2,21 +2,12 @@
""" """
Pure Python GeoIP API Pure Python GeoIP API
The API is based on U{MaxMind's C-based Python The API is based on MaxMind's C-based Python API, but the code itself is
API<http://www.maxmind.com/app/python>}, but the code itself is based on ported from the Pure PHP GeoIP API by Jim Winstead and Hans Lellelid.
the U{pure PHP5 API<http://pear.php.net/package/Net_GeoIP/>} by Jim Winstead
and Hans Lellelid.
It is mostly a drop-in replacement, except the C{new} and C{open} methods @author: Jennifer Ennis <zaylea@gmail.com>
are gone. You should instantiate the L{GeoIP} class yourself:
C{gi = GeoIP('/path/to/GeoIP.dat', pygeoip.MEMORY_CACHE)} @license: Copyright(C) 2004 MaxMind LLC
@author: Jennifer Ennis <zaylea at gmail dot com>
@author: William Tisäter <william@defunct.cc>
@license:
Copyright(C) 2004 MaxMind LLC
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU Lesser General Public License as published by
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Constants needed for parsing binary GeoIP databases. It is part of the pygeoip Constants needed for the binary parser. Part of the pygeoip package.
package.
@author: Jennifer Ennis <zaylea at gmail dot com> @author: Jennifer Ennis <zaylea@gmail.com>
@license: @license: Copyright(C) 2004 MaxMind LLC
Copyright(C) 2004 MaxMind LLC
This program is free software: you can redistribute it and/or modify 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 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'] __all__ = ['time_zone_by_country_and_region']
_country = {} _country = {}
......
# -*- coding: utf-8 -*- # -*- 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: @license: Copyright(C) 2004 MaxMind LLC
Copyright(C) 2004 MaxMind LLC
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU Lesser General Public License as published by
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" """
Setup file for pygeoip package. Setup file for pygeoip package.
...@@ -32,6 +33,8 @@ setup(name='pygeoip', ...@@ -32,6 +33,8 @@ setup(name='pygeoip',
description='Pure Python GeoIP API', description='Pure Python GeoIP API',
author='Jennifer Ennis', author='Jennifer Ennis',
author_email='zaylea@gmail.com', author_email='zaylea@gmail.com',
maintainer='William Tisäter',
maintainer_email='william@defunct.cc',
url='https://github.com/appliedsec/pygeoip', url='https://github.com/appliedsec/pygeoip',
classifiers=['Programming Language :: Python', classifiers=['Programming Language :: Python',
'Programming Language :: Python :: 2.5', '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