403Webshell
Server IP : 35.236.43.222  /  Your IP : 216.73.216.143
Web Server : Apache
System : Linux order-form-vm-001 5.10.0-37-cloud-amd64 #1 SMP Debian 5.10.247-1 (2025-12-11) x86_64
User : deploy ( 1002)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/requests_toolbelt/threaded/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

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||durt��pd}|dkr$td��|�_t���_t���_|�_|pJt	�_
|pTt	�_|�_�fdd�t
�j�D��_dS)Nrz)Number of processes should at least be 1.cs&g|]}t�����j�j�j��qS�)rZ
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�Queuer
rZ
_processes�	_identity�_initializer�_auth�_session�range�_pool)r�	job_queueZinitializerZauth_generatorZ
num_processesZsessionrrr�__init__s




�z
Pool.__init__cCs|�|�|����S�N)rrrrrrrr0szPool._new_sessioncKs0t��}|D]}|�|j�q|fd|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`
        r)rr�put�request_kwargs)�cls�
exceptions�kwargsr�excrrr�from_exceptions3szPool.from_exceptionscKsZddi}|�|pi�t��}|D]$}|��}|�d|i�|�|�q"|fd|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`
        �methodZGET�urlr)�updaterr�copyr)r!Zurlsr r#Zrequest_dictrr'Zjobrrr�	from_urlsIszPool.from_urlsccs|��}|durq|VqdS)zoIterate over all the exceptions in the pool.

        :returns: Generator of :class:`~ThreadException`
        N)�
get_exception)rr$rrrr"bszPool.exceptionscCs8z|j��\}}Wntjy(YdS0t||�SdS)zSGet an exception from the pool.

        :rtype: :class:`~ThreadException`
        N)r�
get_nowaitr�Empty�ThreadException)r�requestr$rrrr+ms
zPool.get_exceptioncCs8z|j��\}}Wntjy(YdS0t||�SdS)zPGet a response from the pool.

        :rtype: :class:`~ThreadResponse`
        N)r
r,rr-�ThreadResponse)rr/�responserrr�get_responseys
zPool.get_responseccs|��}|durq|VqdS)zmIterate over all the responses in the pool.

        :returns: Generator of :class:`~ThreadResponse`
        N)r2)rZresprrr�	responses�szPool.responsescCs|jD]}|��qdS)z*Join all the threads to the master thread.N)r�join)rZsession_threadrrr�join_all�s
z
Pool.join_all)N)�__name__�
__module__�__qualname__�__doc__�requestsZSessionrr�classmethodr%r*r"r+r2r3r5rrrrr	s�

rc@seZdZdZdd�ZdS)�ThreadProxyNcCs4tj}||jvr&|||j�}t||�S|||�SdS)z/Proxy attribute accesses to the proxied object.N)�object�__getattribute__�attrs�proxied_attr�getattr)r�attr�getr1rrr�__getattr__�s


zThreadProxy.__getattr__)r6r7r8r@rDrrrrr<�sr<c@s(eZdZdZdZeddg�Zdd�ZdS)r0a>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()

    r1r cCs||_||_dSr)r r1)rr r1rrrr�szThreadResponse.__init__N�r6r7r8r9r@�	frozensetr?rrrrrr0�sr0c@s(eZdZdZdZeddg�Zdd�ZdS)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 cCs||_||_dSr)r rG)rr rGrrrr�szThreadException.__init__NrErrrrr.�sr.cCs|Srr)Zsession_objrrrr�sr)r.r0r)r9rr:�rZ_compatrr=rr<r0r.r�__all__rrrr�<module>s


Youez - 2016 - github.com/yon3zu
LinuXploit