1

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?

amphibient
  • 29,770
  • 54
  • 146
  • 240
  • 1
    requests.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

0 Answers0