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
504b0f4d
Commit
504b0f4d
authored
Sep 30, 2012
by
William Tisäter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add IPv6 lookup for all name functions
parent
b19f30b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
pygeoip/__init__.py
+7
-7
No files found.
pygeoip/__init__.py
View file @
504b0f4d
...
@@ -398,11 +398,11 @@ class GeoIP(GeoIPBase):
...
@@ -398,11 +398,11 @@ class GeoIP(GeoIPBase):
if
self
.
_databaseType
in
const
.
IPV6_EDITIONS
:
if
self
.
_databaseType
in
const
.
IPV6_EDITIONS
:
try
:
try
:
response
=
socket
.
getaddrinfo
(
hostname
,
0
,
socket
.
AF_INET6
)
response
=
socket
.
getaddrinfo
(
hostname
,
0
,
socket
.
AF_INET6
)
family
,
socktype
,
proto
,
canonname
,
sockaddr
=
response
[
0
]
address
,
port
,
flow
,
scope
=
sockaddr
return
address
except
socket
.
gaierror
:
except
socket
.
gaierror
:
return
''
return
''
family
,
socktype
,
proto
,
canonname
,
sockaddr
=
response
[
0
]
address
,
port
,
flow
,
scope
=
sockaddr
return
address
else
:
else
:
return
socket
.
gethostbyname
(
hostname
)
return
socket
.
gethostbyname
(
hostname
)
...
@@ -543,7 +543,7 @@ class GeoIP(GeoIPBase):
...
@@ -543,7 +543,7 @@ class GeoIP(GeoIPBase):
@return: Organization or ISP name
@return: Organization or ISP name
@rtype: str
@rtype: str
"""
"""
addr
=
s
ocket
.
gethostbyname
(
hostname
)
addr
=
s
elf
.
_
gethostbyname
(
hostname
)
return
self
.
org_by_addr
(
addr
)
return
self
.
org_by_addr
(
addr
)
def
record_by_addr
(
self
,
addr
):
def
record_by_addr
(
self
,
addr
):
...
@@ -583,7 +583,7 @@ class GeoIP(GeoIPBase):
...
@@ -583,7 +583,7 @@ class GeoIP(GeoIPBase):
metro_code, area_code, region_name, time_zone
metro_code, area_code, region_name, time_zone
@rtype: dict
@rtype: dict
"""
"""
addr
=
s
ocket
.
gethostbyname
(
hostname
)
addr
=
s
elf
.
_
gethostbyname
(
hostname
)
return
self
.
record_by_addr
(
addr
)
return
self
.
record_by_addr
(
addr
)
def
region_by_addr
(
self
,
addr
):
def
region_by_addr
(
self
,
addr
):
...
@@ -619,7 +619,7 @@ class GeoIP(GeoIPBase):
...
@@ -619,7 +619,7 @@ class GeoIP(GeoIPBase):
@return: Dictionary containing country_code, region, and region_name
@return: Dictionary containing country_code, region, and region_name
@rtype: dict
@rtype: dict
"""
"""
addr
=
s
ocket
.
gethostbyname
(
hostname
)
addr
=
s
elf
.
_
gethostbyname
(
hostname
)
return
self
.
region_by_addr
(
addr
)
return
self
.
region_by_addr
(
addr
)
def
time_zone_by_addr
(
self
,
addr
):
def
time_zone_by_addr
(
self
,
addr
):
...
@@ -655,5 +655,5 @@ class GeoIP(GeoIPBase):
...
@@ -655,5 +655,5 @@ class GeoIP(GeoIPBase):
@return: Time zone
@return: Time zone
@rtype: str
@rtype: str
"""
"""
addr
=
s
ocket
.
gethostbyname
(
hostname
)
addr
=
s
elf
.
_
gethostbyname
(
hostname
)
return
self
.
time_zone_by_addr
(
addr
)
return
self
.
time_zone_by_addr
(
addr
)
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