Looping Python Application, and timed GET requests.
Hey guys,
I need to build some logic into my python engine where it does not stop after a computation is ran but circles back around, runs another GET request to the endpoint and does the computation, etc again. What is the best way to go about doing this?
I assume one way to do this would be a while loop and if it does not = true then return to top. But sense there is no goto in python I am not sure how to go about setting this up.
here is a paste bin with the current code (NOTE: get requets, etc are commented out for the time being)
Posted Jan 19, 2016, 9:17 PM UTC · edited
The way I do this is I use a function for the gets and computations, and based on what it returns either the script tries again or stops. I use a while loop similar to this:
Thanks for this. I assume the (7) in time.sleep() is seconds? can I set it to miliseconds by doing like:
?
If you hammer a web server every half second, you may end up on the special kids list at whatever company. Just saying.
Endpoint can handle it, had long discussions with the people that handle the actual web side and they said to go for it.
There is a unique use case here where 2 seconds even would be too long.
They can handle that level of volume but don't have an api?