Commits

Vladimir Rusinov committed fbaaa17 Merge

Merged in guilhemfr/ztc/netTimeout (pull request #1)

  • Participants
  • Parent commits 9300a34, 3fbc1d9

Comments (0)

Files changed (1)

src/ztc/net/http/__init__.py

 '''
 
 import urllib2
+import socket
 import time
 
 from ztc.check import ZTCCheck, CheckFail
             # Changed in version 2.6: timeout was added, versions < 2.6 does
             # not have last param
             urllib2.urlopen(url, None)
+        except socket.timeout:
+            #if timeout, return 0 (same behaviour as net.tcp.service.perf)
+            return 0
         return time.time() - start_time