Raise an exception on empty packets (geoip Python class)
This commit is contained in:
parent
148a2a81c8
commit
bc9c8c3dcc
|
@ -75,11 +75,12 @@ class IPToGeo(object):
|
|||
try:
|
||||
self._socket.send(packet)
|
||||
except IOError, e:
|
||||
# Give another chance (we may have been disconnected due to timeout
|
||||
# Give another chance (we may have been disconnected due to timeout)
|
||||
self._create_socket()
|
||||
self._socket.send(packet)
|
||||
packet = self._socket.recv(IPToGeo.PACKET_SIZE)
|
||||
|
||||
if not packet:
|
||||
raise IPToGeoException('Error, empty packet')
|
||||
(ip, country_code) = self._check_request(packet)
|
||||
if country_code:
|
||||
# convert to string
|
||||
|
|
Loading…
Reference in New Issue
Block a user