AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/requests_toolbelt/downloadutils/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/requests_toolbelt/downloadutils/__pycache__/tee.cpython-310.pyc
o

�ˀX
�@sNdZddlZdZgd�Zdd�Zedfdd�Zedfd	d
�Zedfdd�ZdS)
zTee function implementations.�Ni)�tee�tee_to_file�tee_to_bytearrayccs*�|jj||d�D]	}||�|Vq	dS)N)�amt�decode_content)�raw�stream)�response�callback�	chunksizer�chunk�r
�E/usr/lib/python3/dist-packages/requests_toolbelt/downloadutils/tee.py�_tee	s�
��rcCs4dt|dd�vst|tj�std��t||j||�S)a"Stream the response both to the generator and a file.

    This will stream the response body while writing the bytes to
    ``fileobject``.

    Example usage:

    .. code-block:: python

        resp = requests.get(url, stream=True)
        with open('save_file', 'wb') as save_file:
            for chunk in tee(resp, save_file):
                # do stuff with chunk

    .. code-block:: python

        import io

        resp = requests.get(url, stream=True)
        fileobject = io.BytesIO()

        for chunk in tee(resp, fileobject):
            # do stuff with chunk

    :param response: Response from requests.
    :type response: requests.Response
    :param fileobject: Writable file-like object.
    :type fileobject: file, io.BytesIO
    :param int chunksize: (optional), Size of chunk to attempt to stream.
    :param bool decode_content: (optional), If True, this will decode the
        compressed content of the response.
    :raises: TypeError if the fileobject wasn't opened with the right mode
        or isn't a BytesIO object.
    �b�mode�z�tee() will write bytes directly to this fileobject, it must be opened with the "b" flag if it is a file or inherit from io.BytesIO.)�getattr�
isinstance�io�BytesIO�	TypeErrorr�write)r	�
fileobjectrrr
r
rrs
(
�rccsL�t|d��}t||||�D]}|VqWd�dS1swYdS)a�Stream the response both to the generator and a file.

    This will open a file named ``filename`` and stream the response body
    while writing the bytes to the opened file object.

    Example usage:

    .. code-block:: python

        resp = requests.get(url, stream=True)
        for chunk in tee_to_file(resp, 'save_file'):
            # do stuff with chunk

    :param response: Response from requests.
    :type response: requests.Response
    :param str filename: Name of file in which we write the response content.
    :param int chunksize: (optional), Size of chunk to attempt to stream.
    :param bool decode_content: (optional), If True, this will decode the
        compressed content of the response.
    �wbN)�openr)r	�filenamerr�fdrr
r
rrAs��"�rcCs"t|t�s	td��t||j||�S)axStream the response both to the generator and a bytearray.

    This will stream the response provided to the function, add them to the
    provided :class:`bytearray` and yield them to the user.

    .. note::

        This uses the :meth:`bytearray.extend` by default instead of passing
        the bytearray into the ``readinto`` method.

    Example usage:

    .. code-block:: python

        b = bytearray()
        resp = requests.get(url, stream=True)
        for chunk in tee_to_bytearray(resp, b):
            # do stuff with chunk

    :param response: Response from requests.
    :type response: requests.Response
    :param bytearray bytearr: Array to add the streamed bytes to.
    :param int chunksize: (optional), Size of chunk to attempt to stream.
    :param bool decode_content: (optional), If True, this will decode the
        compressed content of the response.
    z4tee_to_bytearray() expects bytearr to be a bytearray)r�	bytearrayrr�extend)r	�bytearrrrr
r
rr\s
r)�__doc__r�_DEFAULT_CHUNKSIZE�__all__rrrrr
r
r
r�<module>s
�1
��

Anon7 - 2022
AnonSec Team