Skip to content

Commit

Permalink
Add missing timeouts to client.py
Browse files Browse the repository at this point in the history
  • Loading branch information
yadima committed May 13, 2019
1 parent 75c8033 commit 6289cb8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions netuitive/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def post(self, element):
'User-Agent': self.agent}
request = urllib2.Request(
self.dataurl, data=payload, headers=headers)
resp = urllib2.urlopen(request)
resp = urllib2.urlopen(request, timeout=self.connection_timeout)
logging.debug("Response code: %d", resp.getcode())

resp.close()
Expand Down Expand Up @@ -133,7 +133,7 @@ def post_event(self, event):
'User-Agent': self.agent}
request = urllib2.Request(
self.eventurl, data=payload, headers=headers)
resp = urllib2.urlopen(request)
resp = urllib2.urlopen(request, timeout=self.connection_timeout)
logging.debug("Response code: %d", resp.getcode())
resp.close()

Expand Down Expand Up @@ -198,7 +198,7 @@ def check_time_offset(self, epoch=None):
req = urllib2.Request(self.timeurl,
headers={'User-Agent': self.agent})
req.get_method = lambda: 'HEAD'
resp = urllib2.urlopen(req)
resp = urllib2.urlopen(req, timeout=self.connection_timeout)
rdate = resp.info()['Date']

if epoch is None:
Expand Down

0 comments on commit 6289cb8

Please sign in to comment.