def from_response(response, url):
<EOL>try:<EOL><INDENT>data = response.json()<EOL>if not isinstance(data, dict):<EOL><INDENT>return from_status(<EOL>response.status_code, response.text,<EOL>extra=dict(url=url, response=response.text)<EOL>)<EOL><DEDENT>code = data.get('<STR_LIT:code>', response.status_code)<EOL>if code in HTTP_STATUS_CODES:<EOL><INDENT>return HTTP_STATUS_CODES[code](**ErrorSchema().load(data))<EOL><DEDENT>else:<EOL><INDENT>return Error(**ErrorSchema().load(data))<EOL><DEDENT><DEDENT>except Exception:<EOL><INDENT>return from_status(<EOL>response.status_code, response.text,<EOL>extra=dict(url=url, response=response.text)<EOL>)<EOL><DEDENT>
Try to create an error from a HTTP response

    :param request.Response response: HTTP response
    :param str url: URL attained
    :return: An error
    :rtype: cdumay_rest_client.errors.Error