Quantcast
Channel: Latest Questions on Splunk Answers
Viewing all articles
Browse latest Browse all 13053

time.sleep not working in modular input ?

$
0
0

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))

Viewing all articles
Browse latest Browse all 13053

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>