
    |h                     F    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	y)z*Module containing the SessionThread class.    N   )queuec                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)SessionThreadc                 \    || _         || _        | j                          || _        || _        y N)_session_jobs_create_worker
_responses_exceptions)selfinitialized_session	job_queueresponse_queueexception_queues        `/var/www/html/test/engine/venv/lib/python3.12/site-packages/requests_toolbelt/threaded/thread.py__init__zSessionThread.__init__   s+    +
(*    c                     t        j                  | j                  t        j                               | _        d| j
                  _        d| j
                  _        | j
                  j                          y )N)targetnameTr   )		threadingThread_make_requestuuiduuid4_workerdaemon_statestartr   s    r   r   zSessionThread._create_worker   sP     ''%%
 #r   c                 d   	  | j                   j                  di |}| j                  j                  ||f       | j                  j                          y # t        j
                  $ r'}| j                  j                  ||f       Y d }~Pd }~ww xY w# | j                  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}},,6v6H OO 23JJ  " ## 	.  &!--	.
 JJ  "s.   A B B)BB BB B/c                     	 	 | j                   j                         }| j	                  |       -# t        j                  $ r Y y w xY wr   )r
   
get_nowaitr   Emptyr-   )r   r*   s     r   r   zSessionThread._make_request&   sI    ..0   (  ;; s   / AAc                 6    | j                   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                   j                          y)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   
   s     +#)'r   r   )
__doc__r   r   requests.exceptions
exceptionsr'   _compatr   objectr   r$   r   r   <module>r=      s     0   ! +F +r   