How do I change this code so that I can call doWork() once in every 60 seconds. Currently, it is looping in definitely and stops after 60 seconds. Want to do the exact reverse.
from twisted.internet import task
from twisted.internet import reactor
import twapi
timeout = 200.0 # Sixty seconds
def doWork():
#do work here
twapi.main('1')
pass
l = task.LoopingCall(doWork)
l.start(timeout) # call every sixty seconds
reactor.run()
From oficial Twisted documentation
from twisted.internet import task
from twisted.internet import reactor
def runEverySecond():
print "a second has passed"
l = task.LoopingCall(runEverySecond)
l.start(1.0) # call every second
reactor.run()