I am currently writing a python script. As I want it to check an API data in real time, so I want it to call the API function every 1 second. How should I done please?
Advertisement
Answer
You can use the following code
JavaScript
x
5
1
import time
2
while True:
3
call_api()
4
time.sleep(1)
5
here call_api
will be called until you stop the program by ctrl+c