When a Request Fails

A web request can fail three ways, no connection, an error status code or no answer in time, and a program handles each with requests' own exceptions, raise_for_status() turning a 4xx or 5xx answer into an HTTPError, a friendly message instead of a traceback, and one more try when the network may come back.

By

Updated

Cheat sheet: When a Request Fails
Category
Python
Level
Journeyman
Tags
404 Not Found, 500 Internal Server Error, Exception (python), python, raise_for_status(), rest-api, Timeout (rest-api), web-development