micropython-lib icon indicating copy to clipboard operation
micropython-lib copied to clipboard

urequests timeout

Open TaylorJayM opened this issue 1 year ago • 6 comments

I currently have a problem that if the wifi is not great a request will hang and hold up the whole script. Is there a way to add a timeout to the request? I don't want to use async requests as the program shouldn't keep running without the current data but i would like to retry the requests until a response is received from the server.

Is there a way to do that?

TaylorJayM avatar Apr 04 '23 22:04 TaylorJayM

+1

The-Judge avatar May 12 '23 20:05 The-Judge

Hi

I have rewritten the library, with some improvements and timeouts.

Do you want to test it ?

After your feedback, I will open source it and propose the new version to the Micropython mantainers.

massimosala avatar Jun 28 '23 20:06 massimosala

Hi

I have rewritten the library, with some improvements and timeouts.

Do you want to test it ?

After your feedback, I will open source it and propose the new version to the Micropython mantainers.

Sure. Is it your repo?

TaylorJayM avatar Jun 29 '23 02:06 TaylorJayM

Hi I have rewritten the library, with some improvements and timeouts. Do you want to test it ? After your feedback, I will open source it and propose the new version to the Micropython mantainers.

Sure. Is it your repo?

Hi Taylor It isn't published on a public repo.

For these first users' feedback, I prefer to "talk" by email. Write me: massimo.sala.71 AT gmail.com

massimosala avatar Jul 07 '23 09:07 massimosala

+1 on wanting a settable timeout. I suspect an os -2 I'm getting is because of a (short) timeout (hard coded) value.

MartinPacker avatar Aug 19 '23 14:08 MartinPacker

So a try / except block stops the -2 from crashing the script. I could still use a shorter timeout. My failures are generally because the server I'm GETting from and POSTing to are on the wrong network in the house. Should be quick to establish and the current timeout isn't.

MartinPacker avatar Sep 15 '23 16:09 MartinPacker