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'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
import requests LoggedInURL = "https://webpage.com/IsLoggedIn" LoggedInHeaders = { 'accept': "application/json", 'AOToken': MyToken, } LoggedInResponse = requests.request("GET", LoggedInURL, headers=LoggedInHeaders) print(LoggedInResponse.json())I want to create a loop where I call LoggedInResponse every third minute. Could it look like this?
import threading def printit(): threading.Timer(180, printit).start() print(LoggedInResponse) printit()