I modified the helloworld in the python modular input example, to poll a website, and calculate the latency.
I don't understand why it is not working when I add a time.sleep, without, it is workint !!?
def do_run():
config = get_input_config()
#TODO , poll for data and print output to STD OUT
vl=1
while vl==1 :
start_timer = time.time()
resp = urllib2.urlopen('http://www.google.com')
content = resp.read()
latency = time.time() - start_timer
print_xml_single_instance_mode( "time=" + str(start_timer) + " latency=" + str(latency) )
#assert (resp.code == 200), 'Bad HTTP Response'
#assert ('Example Web Page' in content), 'Failed Content Verification'
time.sleep(float(60))