My Python 3.8
script consumes an external REST API using requests
, which is sometimes slow. How can I set a time limit to waiting for each response so that it just skips that request and treat that iteration as incomplete, preferably using try-except
?
Asked
Active
Viewed 223 times
1

amphibient
- 29,770
- 54
- 146
- 240
-
1requests.get() takes an optional timeout parameter. See: https://docs.python-requests.org/en/latest/user/quickstart/#make-a-request – DarkKnight Mar 24 '22 at 15:22