133133 sys .exit (4 )
134134
135135__author__ = 'Hari Sekhon'
136- __version__ = '0.7.0 '
136+ __version__ = '0.7.1 '
137137
138138
139139class FindActiveServer (CLI ):
@@ -190,7 +190,6 @@ def add_common_opts(self):
190190 '(for use with --num-threads=1)' )
191191
192192 def process_options (self ):
193- self .validate_common_opts ()
194193 self .url_path = self .get_opt ('url' )
195194 self .regex = self .get_opt ('regex' )
196195 if self .get_opt ('https' ):
@@ -215,6 +214,7 @@ def process_options(self):
215214 self .protocol = 'http'
216215 elif self .protocol == 'ping' :
217216 self .usage ('cannot specify --url-path with --ping, mutually exclusive options!' )
217+ self .validate_common_opts ()
218218
219219 def validate_common_opts (self ):
220220 hosts = self .get_opt ('host' )
@@ -237,6 +237,7 @@ def validate_common_opts(self):
237237
238238 self .num_threads = self .get_opt ('num_threads' )
239239 validate_int (self .num_threads , 'num threads' , 1 , 100 )
240+ self .num_threads = int (self .num_threads )
240241
241242 self .request_timeout = self .get_opt ('request_timeout' )
242243 validate_int (self .request_timeout , 'request timeout' , 1 , 60 )
@@ -388,13 +389,16 @@ def check_http(self, host, port, url_path=''):
388389 try :
389390 # timeout here isn't total timeout, it's response time
390391 req = requests .get (url , timeout = self .request_timeout )
391- except requests .exceptions .RequestException :
392+ except requests .exceptions .RequestException as _ :
393+ log .info ('%s - returned exception: %s' , url , _ )
392394 return False
393- except IOError :
395+ except IOError as _ :
396+ log .info ('%s - returned IOError: %s' , url , _ )
394397 return False
395398 log .debug ("%s - response: %s %s" , url , req .status_code , req .reason )
396399 log .debug ("%s - content:\n %s\n %s\n %s" , url , '=' * 80 , req .content .strip (), '=' * 80 )
397400 if req .status_code != 200 :
401+ log .info ('%s - status code %s != 200' , url , req .status_code )
398402 return None
399403 if self .regex :
400404 log .info ('%s - checking regex against content' , url )
0 commit comments