Interview Prep/Python for DevOps/boto3, HTTP & API errors

A script hangs forever on `requests.get(url)` and never errors.

BeginnerTroubleshootingboto3, HTTP & API errors
Answer

Likely causes → No timeout argument; requests waits indefinitely for a server that accepted the connection but never responds (or a black-holed network path).

Diagnose →

py-spy dump --pid <pid>     # shows the thread blocked in socket recv

Fix → Always pass timeout=(connect, read), e.g. timeout=(3.05, 30).

Prevent → Wrap requests in a Session subclass or helper that enforces a default timeout; Bandit (via ruff S113) flags requests without timeouts.

All Python for DevOps questions Roadmap: Python for automation

More on boto3, HTTP & API errors