🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Configure timeout for webservice consumption

    UiFlow 2.0
    2
    3
    902
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      nestor.toro
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • ajb2k3A
        ajb2k3
        last edited by

        I’m not sure as I haven’t tested but there is a http end request function that release the http request

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        N 1 Reply Last reply Reply Quote 0
        • N
          nestor.toro @ajb2k3
          last edited by

          @ajb2k3 thanks for answering.
          Do you know what the final http function is that you tell me?

          1 Reply Last reply Reply Quote 0
          • First post
            Last post