Skip to content
CodeKruPro

Why pass timeout= to every requests call?

QuizEasy-MediumPython only

A CI job (an automatic test run on a server) running Python API tests hangs for hours on one request. What is the most likely cause?

  • The call has no timeout: requests waits indefinitely by default; pass timeout=10 so it raises requests.exceptions.Timeout instead
  • pytest stops every test after 60 seconds, so it cannot be the request
  • requests retries forever on a slow server
  • The JSON body was too large

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in