Add timeout to Python class
This commit is contained in:
parent
9b0bdae64e
commit
a10ce76381
|
@ -36,6 +36,8 @@ class IPToGeo(object):
|
||||||
|
|
||||||
def _create_socket(self):
|
def _create_socket(self):
|
||||||
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
if not self._timeout is None:
|
||||||
|
self._socket.settimeout(self._timeout)
|
||||||
self._socket.connect((self._remote_addr, self._remote_port))
|
self._socket.connect((self._remote_addr, self._remote_port))
|
||||||
|
|
||||||
def _create_request(self, int_ip):
|
def _create_request(self, int_ip):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user