FastlyResponse
A requests.Response-compatible response object.
This class wraps WIT response objects to provide the familiar requests.Response interface.
Constructor
FastlyResponse(wit_response: http_resp.Response, response_body: async_io.Pollable, url: str)Initialize FastlyResponse.
Parameters
- wit_response: http_resp.Response
The WIT response object
- response_body: async_io.Pollable
The WIT response body
- url: str
The final URL that was requested
Properties
HTTP status code.
Final URL that was requested.
Response headers as a case-insensitive dict.
Response body as bytes.
Response body as unicode string.
True if status code is less than 400.
True if status code is a redirect (3xx).
True if status code is a permanent redirect.
HTTP status reason phrase.
Response encoding.
Methods
json
View sourcejson(**kwargs: Any) -> AnyParse response body as JSON.
Parameters
- **kwargs: Anyoptional
Additional arguments passed to json.loads()
Returns
Any
Parsed JSON data
Throws
- json.JSONDecodeError — If response is not valid JSON
raise_for_status
View sourceraise_for_status() -> NoneRaise an HTTPError for bad responses.
Returns
None
Throws
- HTTPError — If response status indicates an error