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
1bafc985
Commit
1bafc985
authored
Feb 03, 2014
by
William Tisäter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Epydoc strings
parent
fc3dd163
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
48 deletions
+16
-48
pygeoip/__init__.py
+4
-8
pygeoip/const.py
+1
-6
pygeoip/timezone.py
+4
-14
pygeoip/util.py
+6
-14
setup.py
+1
-6
No files found.
pygeoip/__init__.py
View file @
1bafc985
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
"""
Pure Python GeoIP API
Copyright (c) 2010-2014 Jennifer Ennis, William Tisäter.
@author: Jennifer Ennis <zaylea@gmail.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
...
@@ -20,6 +15,7 @@ GNU General Public License for more details.
...
@@ -20,6 +15,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
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>.
along with this program. If not, see <http://www.gnu.org/licenses/lgpl.txt>.
"""
"""
__version__
=
"0.3.1"
__version__
=
"0.3.1"
import
os
import
os
...
@@ -576,7 +572,7 @@ class GeoIP(object):
...
@@ -576,7 +572,7 @@ class GeoIP(object):
def
time_zone_by_addr
(
self
,
addr
):
def
time_zone_by_addr
(
self
,
addr
):
"""
"""
Returns timezone in tzdata format (e.g. America/New_York or Europe/Paris)
Returns time
zone in tzdata format (e.g. America/New_York or Europe/Paris)
:arg addr: IP address (e.g. 203.0.113.30)
:arg addr: IP address (e.g. 203.0.113.30)
"""
"""
...
@@ -589,7 +585,7 @@ class GeoIP(object):
...
@@ -589,7 +585,7 @@ class GeoIP(object):
def
time_zone_by_name
(
self
,
hostname
):
def
time_zone_by_name
(
self
,
hostname
):
"""
"""
Returns timezone in tzdata format (e.g. America/New_York or Europe/Paris)
Returns time
zone in tzdata format (e.g. America/New_York or Europe/Paris)
:arg hostname: Hostname (e.g. example.com)
:arg hostname: Hostname (e.g. example.com)
"""
"""
...
...
pygeoip/const.py
View file @
1bafc985
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
"""
Constants for the database parser
Copyright (c) 2010-2014 Jennifer Ennis, William Tisäter.
@author: Jennifer Ennis <zaylea@gmail.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
...
...
pygeoip/timezone.py
View file @
1bafc985
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
"""
Time zone data and lookup function
Copyright (c) 2010-2014 Jennifer Ennis, William Tisäter.
@author: Jennifer Ennis <zaylea@gmail.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
...
@@ -21,17 +16,12 @@ You should have received a copy of the GNU Lesser General Public License
...
@@ -21,17 +16,12 @@ 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>.
along with this program. If not, see <http://www.gnu.org/licenses/lgpl.txt>.
"""
"""
def
time_zone_by_country_and_region
(
country_code
,
region_code
=
None
):
def
time_zone_by_country_and_region
(
country_code
,
region_code
=
None
):
"""
"""
Get time zone from country code
and region code.
Returns time zone from country
and region code.
@param country_code: Country code
:arg country_code: Country code
@type country_code: str
:arg region_code: Region code
@param region_code: Region code
@type region_code: str
@return: Time zone
@rtype: str
"""
"""
timezone
=
country_dict
.
get
(
country_code
)
timezone
=
country_dict
.
get
(
country_code
)
if
not
timezone
:
if
not
timezone
:
...
...
pygeoip/util.py
View file @
1bafc985
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
"""
Utility function for address translation
Copyright (c) 2010-2014 Jennifer Ennis, William Tisäter.
@author: Jennifer Ennis <zaylea@gmail.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
...
@@ -34,9 +29,9 @@ from pygeoip import const
...
@@ -34,9 +29,9 @@ from pygeoip import const
def
ip2long
(
ip
):
def
ip2long
(
ip
):
"""
"""
Wrapper function for IPv4 and IPv6 converters
Wrapper function for IPv4 and IPv6 converters
.
@param ip: IPv4 or IPv6 address
@type ip: str
:arg ip: IPv4 or IPv6 address
"""
"""
try
:
try
:
return
int
(
binascii
.
hexlify
(
socket
.
inet_aton
(
ip
)),
16
)
return
int
(
binascii
.
hexlify
(
socket
.
inet_aton
(
ip
)),
16
)
...
@@ -46,11 +41,8 @@ def ip2long(ip):
...
@@ -46,11 +41,8 @@ def ip2long(ip):
def
str2fp
(
data
):
def
str2fp
(
data
):
"""
"""
Convert bytes data to file handle object
Convert bytes data to file handle object
(StringIO or BytesIO).
@param data: string data
:arg data: String data to transform
@type data: str
@return: file handle object
@rtype: StringIO or BytesIO
"""
"""
return
BytesIO
(
bytearray
(
data
,
const
.
ENCODING
))
if
const
.
PY3
else
StringIO
(
data
)
return
BytesIO
(
bytearray
(
data
,
const
.
ENCODING
))
if
const
.
PY3
else
StringIO
(
data
)
setup.py
View file @
1bafc985
#!/usr/bin/env python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
"""
Setup file for pygeoip package.
Copyright (c) 2010-2014 Jennifer Ennis, William Tisäter.
@author: Jennifer Ennis <zaylea at gmail dot com>
@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
...
...
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