def __init__(self, size, iterator, encoding='utf-8'):
        #: The expected size of the upload
        self.size = int(size)

        if self.size < 0:
            raise ValueError(
                'The size of the upload must be a positive integer'
                )

        #: Attribute that requests will check to determine the length of the
        #: body. See bug #80 for more details
        self.len = self.size

        #: Encoding the input data is using
        self.encoding = encoding

        #: The iterator used to generate the upload data
        self.iterator = iterator

        if hasattr(iterator, 'read'):
            self._file = iterator
        else:
            self._file = _IteratorAsBinaryFile(iterator, encoding)
dataset/ETHPy150Open sigmavirus24/requests-toolbelt/requests_toolbelt/streaming_iterator.py/StreamingIterator.__init__/original