
    .Ph                     N    d Z ddlZddlZddlmZ ddlmZ  G d de          Z	dS )z*Module containing the SessionThread class.    N   )queuec                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )SessionThreadc                 f    || _         || _        |                                  || _        || _        d S N)_session_jobs_create_worker
_responses_exceptions)selfinitialized_session	job_queueresponse_queueexception_queues        a/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/requests_toolbelt/threaded/thread.py__init__zSessionThread.__init__   s7    +
(*    c                     t          j        | j        t          j                              | _        d| j        _        d| j        _        | j                                         d S )N)targetnameTr   )		threadingThread_make_requestuuiduuid4_workerdaemon_statestartr   s    r   r   zSessionThread._create_worker   sZ     '%
 
 
 #r   c                 D   	  | j         j        di |}| j                            ||f           n8# t          j        $ r&}| j                            ||f           Y d }~nd }~ww xY w| j                                         d S # | j                                         w xY w)N )	r	   requestr   putexcRequestExceptionr   r
   	task_done)r   kwargsresponsees       r   _handle_requestzSessionThread._handle_request   s    	#,t},66v66H O 23333 # 	. 	. 	.  &!--------	.
 J  """""DJ  """"s,   1 B A& A!B !A&&B Bc                     	 	 | j                                         }n# t          j        $ r Y d S w xY w|                     |           Gr   )r
   
get_nowaitr   Emptyr-   )r   r*   s     r   r   zSessionThread._make_request&   s`    	)..00;      (((	)s    00c                 4    | j                                         S )z*Proxy to the thread's ``is_alive`` method.)r   is_aliver"   s    r   r2   zSessionThread.is_alive/   s    |$$&&&r   c                 8    | j                                          dS )z&Join this thread to the master thread.N)r   joinr"   s    r   r4   zSessionThread.join3   s    r   N)	__name__
__module____qualname__r   r   r-   r   r2   r4   r$   r   r   r   r   
   sn        + + +  # # #) ) )' ' '    r   r   )
__doc__r   r   requests.exceptions
exceptionsr'   _compatr   objectr   r$   r   r   <module>r=      sx    0 0      ! ! ! ! ! !      + + + + +F + + + + +r   