
    gx%                         S SK r S SKrS SKJrJrJr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  S SKJr  S SKJr   " S	 S
\5      rg)    N)DictListMutableMappingOptionalTuple)urlparse
urlunparse)__version__)
HttpClient)TwilioHttpClient)Response)CredentialProviderc                   ,   \ rS rSrSr         SS\\   S\\   S\\   S\\   S\\   S	\\\\4      S
\\   S\\	\      S\\
   4S jjr      S S\S\S\\\\4      S\\\\4      S\\\\4      S\\\\4      S\\   S\S\4S 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\\\\4      S\\\4   4S jrS\S\\\\4      S\\\4   4S jrS\S\4S jrS\4S jrSrg)!
ClientBase   z&A client for accessing the Twilio API.Nusernamepasswordaccount_sidregionhttp_clientenvironmentedgeuser_agent_extensionscredential_providerc
                    U=(       d    [         R                  nU=(       d    UR                  S5      U l         U=(       d    UR                  S5      U l         U=(       d    UR                  S5      U l         U=(       d    UR                  S5      U l         U=(       d    / U l         U	=(       d    SU l         U=(       d    U R                  U l	         U R                  U R                  4U l
         U=(       d
    [        5       U l        g)a}  
Initializes the Twilio Client

:param username: Username to authenticate with
:param password: Password to authenticate with
:param account_sid: Account SID, defaults to Username
:param region: Twilio Region to make requests to, defaults to 'us1' if an edge is provided
:param http_client: HttpClient, defaults to TwilioHttpClient
:param environment: Environment to look for auth details, defaults to os.environ
:param edge: Twilio Edge to make requests to, defaults to None
:param user_agent_extensions: Additions to the user agent string
:param credential_provider: credential provider for authentication method that needs to be used
TWILIO_ACCOUNT_SIDTWILIO_AUTH_TOKENTWILIO_EDGETWILIO_REGIONN)osenvirongetr   r   r   r   r   r   r   authr   r   )
selfr   r   r   r   r   r   r   r   r   s
             _/Users/Alptekin/Desktop/izin_takip/venv/lib/python3.13/site-packages/twilio/base/client_base.py__init__ClientBase.__init__   s    4 "/RZZ IKOO4H$I HKOO4G$H:KOOM:	@ @%:%@b"!#6#>$ *&7$--]]DMM2	''2'H6F6H"    methoduriparamsdataheadersr#   timeoutallow_redirectsreturnc	                    U R                  X5      nU R                  (       a.  U R                  R                  5       n	U	R                  5       US'   O.U R                  b  U R
                  b  U R                  U5      nOSnUS:X  a  US	 U R                  U5      nU R                  U5      n
U R                  R                  UUUU
UUUUS9$ )a  
Makes a request to the Twilio API using the configured http client
Authentication information is automatically added if none is provided

:param method: HTTP Method
:param uri: Fully qualified url
:param params: Query string parameters
:param data: POST body data
:param headers: HTTP Headers
:param auth: Authentication
:param timeout: Timeout in seconds
:param allow_redirects: Should the client follow redirects

:returns: Response from the Twilio API
AuthorizationNDELETEAcceptr+   r,   r-   r#   r.   r/   )get_headersr   to_auth_strategyget_auth_stringr   r   get_authget_hostnamecopy_non_none_valuesr   requestr$   r)   r*   r+   r,   r-   r#   r.   r/   auth_strategyfiltered_datas              r%   r<   ClientBase.request@   s    4 ""63## 44EEGM'4'D'D'FGO$]]&4==+D==&DDX!$11$7''+ ( 	
 		
r(   c	                   #    U R                   R                  (       d  [        S5      eU R                  X5      nUS:X  a  US	 U R                  (       a.  U R                  R                  5       n	U	R                  5       US'   O.U R                  b  U R                  b  U R                  U5      nOSnU R                  U5      nU R                  U5      n
U R                   R                  UUUU
UUUUS9I Sh  vN $  N7f)a  
Asynchronously makes a request to the Twilio API  using the configured http client
The configured http client must be an asynchronous http client
Authentication information is automatically added if none is provided

:param method: HTTP Method
:param uri: Fully qualified url
:param params: Query string parameters
:param data: POST body data
:param headers: HTTP Headers
:param auth: Authentication
:param timeout: Timeout in seconds
:param allow_redirects: Should the client follow redirects

:returns: Response from the Twilio API
z>http_client must be asynchronous to support async API requestsr3   r4   r2   Nr5   )r   is_asyncRuntimeErrorr6   r   r7   r8   r   r   r9   r:   r;   r<   r=   s              r%   request_asyncClientBase.request_asyncu   s     6 ((P  ""63X!## 44EEGM'4'D'D'FGO$]]&4==+D==&DD$11$7%%--+ . 	
 	
 		
 	
s   C3C<5C:6C<c                 .   [        U[        5      (       a9  UR                  5        VVs0 s H  u  p#Uc  M
  X R                  U5      _M     snn$ [        U[        5      (       a&  U Vs/ s H  oDc  M  U R                  U5      PM     sn$ U$ s  snnf s  snf )N)
isinstancedictitemsr;   list)r$   r,   kvitems        r%   r;   ClientBase.copy_non_none_values   s    dD!! !JJL(DA 0,,Q//( 
 d##<@<@D/))$/D  s   	BB(B2Bc                 ,    U=(       d    U R                   $ )z|
Get the request authentication object
:param auth: Authentication (username, password)
:returns: The authentication object
)r#   )r$   r#   s     r%   r9   ClientBase.get_auth   s      tyy r(   c                    U=(       d    0 n[         n[        R                  " 5       n[        R                  " 5       n[        R                  " 5       nSR                  UUUU5      US'   U R                   H  nUS==   SR                  U5      -  ss'   M!     SR                  [         5      US'   SUS'   US:X  d  US	:X  a  S
U;  a  SUS
'   SU;  a  SUS'   U$ )z
Get the request headers including user-agent, extensions, encoding, content-type, MIME type
:param method: HTTP method
:param headers: HTTP headers
:returns: HTTP headers
z"twilio-python/{} ({} {}) Python/{}z
User-Agentz {}z	python-{}zX-Twilio-Clientzutf-8zAccept-CharsetPOSTPUTzContent-Typez!application/x-www-form-urlencodedr4   zapplication/json)r
   platformsystemmachinepython_versionformatr   )r$   r)   r-   pkg_versionos_nameos_archrW   	extensions           r%   r6   ClientBase.get_headers   s     -R "//#""$!002 D K K	!
 33IL!U\\)%<<! 4%0%7%7%D!" %, !f%nG6S&IGN#7" 2GHr(   c                 H   U R                   (       d  U R                  (       d  U$ [        U5      nUR                  R	                  S5      nUS   nSR                  USS 5      nSnSn[        U5      S:X  a  US   nO[        U5      S:X  a
  US   nUS   nU R                   =(       d    UnU R                  =(       d    U=(       d    U=(       a    S	nUR                  SR                  XGXe4 Vs/ s H  o(       d  M  UPM     sn5      S
9n[        [        U5      5      $ s  snf )z
Determines the proper hostname given edge and region preferences
via client configuration or uri.

:param uri: Fully qualified url

:returns: The final uri used to make the request
.r   N            us1)netloc)
r   r   r   rf   splitjoinlen_replacestrr	   )	r$   r*   
parsed_urlpiecesprefixsuffixr   r   parts	            r%   r:   ClientBase.get_hostname   s    yyJc]
""((-&+&v;!AYF[A!9DAYFyy D::4>E((88vV.LU.LdPTT.LUV ) 

 :j)** Vs   .
D<Dc                 8    SR                  U R                  5      $ )zN
Provide a friendly representation

:returns: Machine friendly representation
z<Twilio {}>)rX   r   )r$   s    r%   __repr__ClientBase.__repr__	  s     ##D$4$455r(   )	r   r#   r   r   r   r   r   r   r   )	NNNNNNNNN)NNNNNF)__name__
__module____qualname____firstlineno____doc__r   rk   r   r   r   r   r&   r   objectr   floatboolr   r<   rD   r;   r9   r6   r:   rs   __static_attributes__ r(   r%   r   r      s   0 #'"&%) $,0:>"59<@.#3-.# 3-.# c]	.#
 .# j).# nS#X67.# sm.#  (S	2.# &&89.#h /3,0,0*.#' %3
3
 3
 c6k*+	3

 tCK()3
 $sCx.)3
 uS#X'3
 %3
 3
 
3
r /3,0,0*.#' %7
7
 7
 c6k*+	7

 tCK()7
 $sCx.)7
 uS#X'7
 %7
 7
 
7
r!XeCHo6 !5c? !""$,T#s(^$<"	c3h"H +  +  +D6# 6r(   r   )r    rT   typingr   r   r   r   r   urllib.parser   r	   twilior
   twilio.httpr   twilio.http.http_clientr   twilio.http.responser   %twilio.credential.credential_providerr   rz   r   r~   r(   r%   <module>r      s1    	  > > -  " 4 ) DB6 B6r(   