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.
More on boto3, HTTP & API errors
`botocore.exceptions.NoCredentialsError: Unable to locate credentials`Beginner`botocore.exceptions.NoRegionError: You must specify a region.` even though `AWS_REGION` is set.Intermediate`botocore.exceptions.ClientError: An error occurred (UnauthorizedOperation) when calling the DescribeInstances operation: You are not authorized to perform this operation.`Beginner`An error occurred (ExpiredToken) when calling the ... operation: The security token included in the request is expired` midway through a long job.Advanced`An error occurred (RequestLimitExceeded) when calling the DescribeInstances operation (reached max retries: 4): Request limit exceeded.`Intermediate`An error occurred (InvalidClientTokenId) when calling the GetCallerIdentity operation: The security token included in the request is invalid.`Beginner