Module Expr Str ImportFrom alias ImportFrom alias alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Str body Assign AttributeStore NameLoad attr Call NameLoad NameLoad If CompareLt AttributeLoad NameLoad attr Num body Raise Call NameLoad Str Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad If Call NameLoad NameLoad Str body Assign AttributeStore NameLoad attr NameLoad orelse Assign AttributeStore NameLoad attr Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Return Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults Str body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad decorator_list FunctionDef arguments args NameParam defaults body TryExcept body Return Call NameLoad Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad body Return Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore BinOpSub NameLoad Call NameLoad AttributeLoad NameLoad attr Assign NameStore NameLoad While BoolOpAnd CompareGt NameLoad Num NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AugAssignSub NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Assign NameStore Call NameLoad NameLoad If CompareEq NameLoad Num body Return Call AttributeLoad Str attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list decorator_list
N/A N/A 

requests_toolbelt.streaming_iterator
====================================

This holds the implementation details for the :class:`StreamingIterator`. It
is designed for the case where you, the user, know the size of the upload but
need to provide the data as an iterator. This class will allow you to specify
the size and stream the data without using a chunked transfer-encoding.

 requests.utils super_len multipart.encoder CustomBytesIO encode_with StreamingIterator N/A object N/A N/A 
    This class provides a way of allowing iterators with a known size to be
    streamed instead of chunked.

    In requests, if you pass in an iterator it assumes you want to use
    chunked transfer-encoding to upload the data, which not all servers
    support well. Additionally, you may want to set the content-length
    yourself to avoid this but that will not work. The only way to preempt
    requests using a chunked transfer-encoding and forcing it to stream the
    uploads is to mimic a very specific interace. Instead of having to know
    these details you can instead just use this class. You simply provide the
    size and iterator and pass the instance of StreamingIterator to requests
    via the data parameter like so:

    .. code-block:: python

        from requests_toolbelt import StreamingIterator

        import requests

        # Let iterator be some generator that you already have and size be
        # the size of the data produced by the iterator

        r = requests.post(url, data=StreamingIterator(size, iterator))

    You can also pass file-like objects to :py:class:`StreamingIterator` in
    case requests can't determize the filesize itself. This is the case with
    streaming file objects like ``stdin`` or any sockets. Wrapping e.g. files
    that are on disk with ``StreamingIterator`` is unnecessary, because
    requests can determine the filesize itself.

    Naturally, you should also set the `Content-Type` of your upload
    appropriately because the toolbelt will not attempt to guess that for you.
     __init__ N/A N/A self size iterator encoding N/A utf-8 N/A N/A N/A self size N/A int size N/A N/A N/A self size 0 N/A N/A N/A ValueError The size of the upload must be a positive integer N/A N/A self len N/A self size N/A N/A self encoding encoding N/A N/A self iterator iterator N/A N/A hasattr iterator read N/A N/A N/A self _file iterator N/A N/A N/A self _file N/A _IteratorAsBinaryFile iterator encoding N/A read N/A N/A self size N/A -1 N/A N/A N/A encode_with N/A N/A N/A self _file read size N/A self encoding N/A N/A _IteratorAsBinaryFile N/A object N/A __init__ N/A N/A self iterator encoding N/A utf-8 N/A N/A N/A self iterator iterator N/A N/A self encoding encoding N/A N/A self _buffer N/A CustomBytesIO N/A _get_bytes N/A N/A self N/A N/A N/A N/A N/A N/A encode_with N/A next N/A self iterator N/A self encoding N/A N/A N/A StopIteration N/A N/A N/A _load_bytes N/A N/A self size N/A N/A N/A N/A N/A N/A self _buffer smart_truncate N/A amount_to_load N/A size N/A super_len N/A self _buffer N/A bytes_to_append True N/A N/A N/A amount_to_load 0 bytes_to_append N/A N/A bytes_to_append N/A N/A self _get_bytes N/A amount_to_load N/A N/A N/A self _buffer append bytes_to_append N/A read N/A N/A self size N/A -1 N/A N/A size N/A int size N/A N/A size -1 N/A N/A N/A N/A join N/A self iterator N/A N/A N/A self _load_bytes size N/A N/A N/A N/A self _buffer read size N/A N/A