Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def error_for(self, status_code, parsed): # noqa: C901
if status_code is None:
return NetworkError
if status_code >= 500:
return ServerError
if status_code == 401:
return AuthenticationError
if status_code == 404:
return NotFoundError
if status_code >= 400:
return ClientError
if not parsed:
return ParserError