From a10ce763812541ebbd40cc95b98a562c87dc46cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Thu, 4 Feb 2016 20:39:50 +0100 Subject: [PATCH] Add timeout to Python class --- tests/iptogeo.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/iptogeo.py b/tests/iptogeo.py index 847f8a9..6adca16 100644 --- a/tests/iptogeo.py +++ b/tests/iptogeo.py @@ -36,6 +36,8 @@ class IPToGeo(object): def _create_socket(self): 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)) def _create_request(self, int_ip):