Running a timer for few minutes in python
问题 I am trying to run a certain function "foo" every second. I have to do this for a few minutes (say 5). The function foo() makes 100 HTTP Requests (which contains a JSON object) to the server and prints the JSON response. In short, I have to make 100 HTTP requests per second for 5 minutes. I have just started learning python, thus don't have extensive knowledge. This is what I have tried: import threading noOfSecondsPassed = 0 def foo(): global noOfSecondsPassed # piece of code which makes 100