def test_should_parse_schema_from_quoted_profile(self, get): headers = { 'content-type': ( 'application/json; charset=utf-8; profile="%s"' % self.SCHEMA_URL) } schema.from_header(headers) get.assert_called_with(self.SCHEMA_URL, headers=ANY)
def from_response(response, auth=None): try: data = response.json() except ValueError: data = {} return Resource(url=response.url, auth=auth, data=data, schema=schema.from_header(response.headers, auth), response=response)
def from_response(response, auth=None): try: data = response.json() except ValueError: data = {} return Resource( url=response.url, auth=auth, data=data, schema=schema.from_header(response.headers, auth) )
def from_response(klass, response, auth=None): try: data = response.json() except ValueError: data = {} return klass( url=response.url, auth=auth, data=data, schema=schema.from_header(response.headers, auth), response=response )