Sort out L441 in 2a756807 - res.error included all non-OK status codes, as well as the RequestExceptions, so for requests 1.1+ it needs to be replaced by "not res.ok". In get_task_status catch the precise exception, rather than the catch-all, and deal with it straight away since the response object does not exist in this circumstance. HTTP_ERROR_CODES can go, now that requests has res.reason.