Timeout for urequests.get()

I can’t find any way to set the timeout for urequests.get(URL). Using sockets directly there’s an option: settimeout(i) and I find on my busy network that 4 seconds is better than 1 second. It would be helpful if there was a timeout setting for urequests.get() as well.

Thanks,
David

Should be able to use urequests.get(‘https://github.com/’, timeout=5)

For a 5 second timeout

1 Like

Thanks very much! I hadn’t spotted that option. It’s running on my Pico W now, so let’s see whether it resolves the problem.

David

Thanks exussum, it works nicely. Without the timeout the program hangs, with the timeout the program will try again on the next iteration, 30 minutes later.

David