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
ad1f235f
Commit
ad1f235f
authored
Aug 22, 2013
by
William Tisäter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove dead code
parent
0b964257
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
11 deletions
+4
-11
pygeoip/__init__.py
+4
-11
No files found.
pygeoip/__init__.py
View file @
ad1f235f
...
...
@@ -410,13 +410,10 @@ class GeoIP(object):
def
_gethostbyname
(
self
,
hostname
):
if
self
.
_databaseType
in
const
.
IPV6_EDITIONS
:
try
:
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
:
return
''
response
=
socket
.
getaddrinfo
(
hostname
,
0
,
socket
.
AF_INET6
)
family
,
socktype
,
proto
,
canonname
,
sockaddr
=
response
[
0
]
address
,
port
,
flow
,
scope
=
sockaddr
return
address
else
:
return
socket
.
gethostbyname
(
hostname
)
...
...
@@ -430,10 +427,6 @@ class GeoIP(object):
@return: network byte order 32-bit integer
@rtype: int
"""
COUNTY_EDITIONS
=
(
const
.
COUNTRY_EDITION
,
const
.
COUNTRY_EDITION_V6
)
if
self
.
_databaseType
not
in
COUNTY_EDITIONS
:
raise
GeoIPError
(
'Invalid database type, expected Country'
)
ipv
=
6
if
addr
.
find
(
':'
)
>=
0
else
4
if
ipv
==
4
and
self
.
_databaseType
!=
const
.
COUNTRY_EDITION
:
raise
GeoIPError
(
'Invalid database type; expected IPv6 address'
)
...
...
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