Response Reference botocore 1.10.50 documentation

Wrapper class for an http response body. This provides a few additional conveniences that do not exist in the urllib3 model: Close the underlying http response stream. Return an iterator to yield chunks of chunk_size bytes from the raw stream.

  • Docs
  • Response Reference
  • botocore.response

    class botocore.response.StreamingBody(raw_stream, content_length)

    Wrapper class for an http response body.

    This provides a few additional conveniences that do not exist in the urllib3 model:

    • Set the timeout on the socket (i.e read() timeouts)
    • Auto validation of content length, if the amount of bytes we read does not match the content length, an exception is raised.
    close()

    Close the underlying http response stream.

    iter_chunks(chunk_size=1024)

    Return an iterator to yield chunks of chunk_size bytes from the raw stream.

    iter_lines(chunk_size=1024)

    Return an iterator to yield lines from the raw stream.

    This is achieved by reading chunk of bytes (of size chunk_size) at a time from the raw stream, and then yielding lines from there.

    read(amt=None)

    Read at most amt bytes from the stream.

    If the amt argument is omitted, read all data.

    set_socket_timeout(timeout)

    Set the timeout seconds on the socket.

    ncG1vNJzZmian6m8pLvRnmWapZGvvK%2Bt1qxlnKedZMNye8Oomq6llaPBosDIqKVomaCefHJ6kGllbmhfp7KnsdGepZydX6eytLzOp6qeZpipuq0%3D

     Share!