urequest timeout sometimes works and sometimes doesn't. #16529
Unanswered
akisha009
asked this question in
Libraries & Drivers
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey,
I'm using rpi pico w and I'm trying to send API request to my server. The problem is, sometimes (because of the wifi or I dont know what), the request just doesnt want to get sent and It just stops all my code.
To fix this, I tried using timeout.
First time I tried this, It just straight wasn't working. I put the
response = urequests.get(url, timeout=5)
and It just stays there. I changed that timeout value like 100 times and It didn't help.Then I tried to go in the library and change the default value for timeout from None to 10 seconds (10 for testing) and boom, the 5 seconds would overwrite the 10 seconds default value. I change the default and in my code both to 5 seconds and it worked untill a few minutes.
Now both default timeout and in my code timeout are set to 5 seconds and STILL the timeout timer never runs out so my code is just stopped.
Is there a way to fix this or maybe I can make a function that functions like this:
Any suggestions are welcome!
Beta Was this translation helpful? Give feedback.
All reactions