Apr-02-2018, 12:01 PM
Hey, I'm kinda new to Python and need help with a loop.
I'm calling functions through a website's API, and in order to stay logged in I need to call a request-function every 3rd minute
I want to create a loop where I call LoggedInResponse every third minute. Could it look like this?
I'm calling functions through a website's API, and in order to stay logged in I need to call a request-function every 3rd minute
1 2 3 4 5 6 7 8 9 10 11 12 |
import requests LoggedInHeaders = { 'accept' : "application/json" , 'AOToken' : MyToken, } LoggedInResponse = requests.request( "GET" , LoggedInURL, headers = LoggedInHeaders) print (LoggedInResponse.json()) |
1 2 3 4 5 6 7 |
import threading def printit(): threading.Timer( 180 , printit).start() print (LoggedInResponse) printit() |