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
b19f30b8
Commit
b19f30b8
authored
Sep 30, 2012
by
William Tisäter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update README documentation
parent
c261935e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
28 deletions
+55
-28
README.md
+20
-6
pygeoip/__init__.py
+4
-13
pygeoip/const.py
+3
-5
pygeoip/timezone.py
+22
-0
pygeoip/util.py
+3
-4
setup.py
+3
-0
No files found.
README.md
View file @
b19f30b8
...
...
@@ -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')
'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 ###
>>> gi
c
= pygeoip.GeoIP('/path/to/GeoIPCity.dat')
>>> gi
c
.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',
...
...
@@ -56,11 +62,19 @@ Create your GeoIP instance with appropriate access flag. `STANDARD` reads data f
'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
)
.
pygeoip/__init__.py
View file @
b19f30b8
...
...
@@ -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
...
...
pygeoip/const.py
View file @
b19f30b8
# -*- 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
...
...
pygeoip/timezone.py
View file @
b19f30b8
# -*- 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
=
{}
...
...
pygeoip/util.py
View file @
b19f30b8
# -*- coding: utf-8 -*-
"""
Misc. utility functions. It is p
art of the pygeoip package.
Utility functions. P
art 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
...
...
setup.py
View file @
b19f30b8
#!/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'
,
...
...
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