Configure timeout for webservice consumption
-
Hi guys. I am making an application in my m5stack fire which makes the call to a web service through these lines:
import urequests
response = urequests.get("myurl.com")
if response.status_code == 200:
jsonResponse = ujson.loads(response.text)
response.close
break
else:
label8.setText("Error web service")
wait_ms(2000)Sometimes, the web service does not respond properly and the device continues to consume indefinitely.
Can the web service be called in such a way that I can configure a timeout of x seconds, so that when the web service does not respond my application can continue its flow?
My m5stack fire device uses UIFlow_Fire 1.13.1 firmware based on Micropython-1.12
Thanks for your help.
-
I’m not sure as I haven’t tested but there is a http end request function that release the http request
-
@ajb2k3 thanks for answering.
Do you know what the final http function is that you tell me?