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?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login