AWS Request Reference#

botocore.awsrequest#

class botocore.awsrequest.AWSPreparedRequest(method, url, headers, body, stream_output)#

A data class representing a finalized request to be sent over the wire.

Requests at this stage should be treated as final, and the properties of the request should not be modified.

Variables:
  • method – The HTTP Method

  • url – The full url

  • headers – The HTTP headers to send.

  • body – The HTTP body.

  • stream_output – If the response for this request should be streamed.

reset_stream()#

Resets the streaming body to it’s initial position.

If the request contains a streaming body (a streamable file-like object) seek to the object’s initial position to ensure the entire contents of the object is sent. This is a no-op for static bytes-like body types.

class botocore.awsrequest.AWSResponse(url, status_code, headers, raw)#

A data class representing an HTTP response.

This class was originally inspired by requests.models.Response, but has been boiled down to meet the specific use cases in botocore. This has effectively been reduced to a named tuple.

Variables:
  • url – The full url.

  • status_code – The status code of the HTTP response.

  • headers – The HTTP headers received.

  • body – The HTTP response body.

property content#

Content of the response as bytes.

property text#

Content of the response as a proper text type.

Uses the encoding type provided in the reponse headers to decode the response content into a proper text type. If the encoding is not present in the headers, UTF-8 is used as a default.