
    g                         S SK r S SKJrJrJr  S SKJrJr  S SKJ	r	J
r
  S SKJr  S SKJr  S SKJr  \ R$                  " S5      r " S	 S
\5      rg)    N)DictOptionalTuple)	BasicAuthClientSession)ExponentialRetryRetryClient)AsyncHttpClient)Request)Responseztwilio.async_http_clientc                     ^  \ rS rSrSrSSS\SS4S\S\\   S\	R                  S\\   S	\\   4
U 4S
 jjjr      SS\S\S\\\\4      S\\\\4      S\\\\4      S\\\\4      S\\   S\S\4S jjrS rS rS rSrU =r$ )AsyncTwilioHttpClient   zN
General purpose asynchronous HTTP Client for interacting with the Twilio API
TNpool_connectionstimeoutlogger	proxy_urlmax_retriesc                    > [         TU ]  USU5        XPl        X l        U(       a  [	        U R                  S9OSU l        Ub#  [        US9n[        U R
                  US9U l        gg)a  
Constructor for the AsyncTwilioHttpClient

:param pool_connections: Creates a client session for making requests from.
:param trace_configs: Configuration used to trace request lifecycle events. See aiohttp library TraceConfig
                      documentation for more info.
:param timeout: Timeout for the requests (seconds)
:param logger
:param proxy_url: Proxy URL
:param max_retries: Maximum number of retries each request should attempt
T)trace_configsN)attempts)client_sessionretry_options)super__init__r   r   r   sessionr   r	   )	selfr   r   r   r   r   r   r   	__class__s	           e/Users/Alptekin/Desktop/izin_takip/venv/lib/python3.13/site-packages/twilio/http/async_http_client.pyr   AsyncTwilioHttpClient.__init__   sl    ( 	w/"*   (:(:; 	
 ",kBM&#||=DL #    methodurlparamsdataheadersauthallow_redirectsreturnc	           	        #    Ub  US::  a  [        U5      eSn	Ub  [        US   US   S9n	UR                  5       UUUUU	UUS.n
U R                  U
5        SU l        SnSnU R
                  (       a  U R
                  nO[        5       nSn[        S0 U
D6U l        UR                  " S0 U
D6I Sh  vN nU R                  UR                  U5        [        UR                  UR                  5       I Sh  vN UR                  5      U l        U(       a  UR                  5       I Sh  vN   U R                  $  N NE N7f)	ah  
Make an asynchronous HTTP Request with parameters provided.

:param method: The HTTP method to use
:param url: The URL to request
:param params: Query parameters to append to the URL
:param data: Parameters to go in the body of the HTTP request
:param headers: HTTP Headers to send with the request
:param auth: Basic Auth arguments (username, password entries)
:param timeout: Socket/Read timeout for the request. Overrides the timeout if set on the client.
:param allow_redirects: Whether or not to allow redirects
See the requests documentation for explanation of all these parameters

:return: An http response
Nr      )loginpassword)r"   r#   r$   r%   r&   r'   r   r(   FT )
ValueErrorr   upperlog_request_test_only_last_responser   r   TwilioRequest_test_only_last_requestrequestlog_responsestatusr   textr&   close)r   r"   r#   r$   r%   r&   r'   r   r(   
basic_authkwargstempr   responses                 r   r5   AsyncTwilioHttpClient.request5   s0    4 7a<W%%
"a47CJ lln.	
 	 (,%<<llG#oGD'4'>v'>$ 2622(//84(0OO8==?2H4D4D)
% --/!!,,, 3 3 "s7   B.D>0D81AD>4D:
52D>'D<(D>:D><D>c                 x   #    U R                   (       a#  U R                   R                  5       I Sh  vN   gg N7f)z 
Closes the HTTP client session
Nr   r9   r   s    r   r9   AsyncTwilioHttpClient.closeu   ,      <<,,$$&&& &   /:8:c                    #    U $ 7f)z
Async context manager setup
r.   rA   s    r   
__aenter__ AsyncTwilioHttpClient.__aenter__|   s      s   c                 x   #    U R                   (       a#  U R                   R                  5       I Sh  vN   gg N7f)z
Async context manager exit
Nr@   )r   excinfos     r   	__aexit__AsyncTwilioHttpClient.__aexit__   rC   rD   )r4   r2   r   r   r   )NNNNNF)__name__
__module____qualname____firstlineno____doc___loggerboolr   floatloggingLoggerstrintr   r   objectr   r   r5   r9   rF   rJ   __static_attributes____classcell__)r   s   @r   r   r      s'    "&#'!(#'%)   %	 
   C=  c]   L /3,0,0*.#' %>->- >- c6k*+	>-
 tCK()>- $sCx.)>- uS#X'>- %>- >- 
>-@'' 'r!   r   )rT   typingr   r   r   aiohttpr   r   aiohttp_retryr   r	   twilio.httpr
   twilio.http.requestr   r3   twilio.http.responser   	getLoggerrQ   r   r.   r!   r   <module>rb      s<     ( ( , 7 ' 8 )


6
7y'O y'r!   