
    (phW                        S r SSKJr  SSKrSSKrSSKrSSKrSSKr SSKrSSKrSSK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KrSS
KJr  \R0                  " \5      rSr " S S\R8                  5      r " S S\5      r " S S\R@                  5      r  " S S\RB                  RD                  5      r# " S S\RB                  RD                  5      r$ " S S\RJ                  5      r&g! \	 a  r
\	" S5      \
eSr
C
ff = f)zTransport adapter for Requests.    )absolute_importNzmThe requests library is not installed from please install the requests package to use the requests transport.)create_urllib3_context)_helpers)environment_vars)
exceptions)	transport)service_accountx   c                   N    \ rS rSrSrS r\S 5       r\S 5       r\S 5       r	Sr
g)		_Response1   ziRequests transport response adapter.

Args:
    response (requests.Response): The raw Requests response.
c                     Xl         g N	_response)selfresponses     Q/var/www/html/venv/lib/python3.13/site-packages/google/auth/transport/requests.py__init___Response.__init__8   s    !    c                 .    U R                   R                  $ r   )r   status_coder   s    r   status_Response.status;   s    ~~)))r   c                 .    U R                   R                  $ r   )r   headersr   s    r   r   _Response.headers?       ~~%%%r   c                 .    U R                   R                  $ r   )r   contentr   s    r   data_Response.dataC   r    r   r   N)__name__
__module____qualname____firstlineno____doc__r   propertyr   r   r#   __static_attributes__ r   r   r   r   1   sH    " * * & & & &r   r   c                   X    \ rS rSrSr\R                  R                  4S jrS r	S r
Srg)TimeoutGuardH   a-  A context manager raising an error if the suite execution took too long.

Args:
    timeout (Union[None, Union[float, Tuple[float, float]]]):
        The maximum number of seconds a suite can run without the context
        manager raising a timeout exception on exit. If passed as a tuple,
        the smaller of the values is taken as a timeout. If ``None``, a
        timeout error is never raised.
    timeout_error_type (Optional[Exception]):
        The type of the error to raise on timeout. Defaults to
        :class:`requests.exceptions.Timeout`.
c                 (    Xl         Xl        X l        g r   )_timeoutremaining_timeout_timeout_error_type)r   timeouttimeout_error_types      r   r   TimeoutGuard.__init__V   s    !(#5 r   c                 :    [         R                   " 5       U l        U $ r   )time_startr   s    r   	__enter__TimeoutGuard.__enter__[   s    iikr   c                   ^ U(       a  g U R                   c  g [        R                  " 5       U R                  -
  mSn[        U R                   [        R
                  5      (       a$  U R                   T-
  U l        U R                  S:*  nO<[        U4S jU R                    5       5      U l        [        U R                  5      S:*  nU(       a  U R                  5       eg )NFr   c              3   ,   >#    U  H	  oT-
  v   M     g 7fr   r,   ).0xelapseds     r   	<genexpr>(TimeoutGuard.__exit__.<locals>.<genexpr>m   s     *N1w;s   )
r1   r8   r9   
isinstancenumbersNumberr2   tupleminr3   )r   exc_type	exc_value	tracebackdeadline_hitr@   s        @r   __exit__TimeoutGuard.__exit___   s    == ))++dmmW^^44%)]]W%<D"11Q6L%**N*N%ND"t556!;L**,, r   )r9   r1   r3   r2   N)r%   r&   r'   r(   r)   requestsr   Timeoutr   r:   rL   r+   r,   r   r   r.   r.   H   s'     4<3F3F3N3N 6
-r   r.   c                   :    \ rS rSrSrS	S jrS rSSS\4S jrSr	g)
Requestt   a  Requests request adapter.

This class is used internally for making requests using various transports
in a consistent way. If you use :class:`AuthorizedSession` you do not need
to construct or use this class directly.

This class can be useful if you want to manually refresh a
:class:`~google.auth.credentials.Credentials` instance::

    import google.auth.transport.requests
    import requests

    request = google.auth.transport.requests.Request()

    credentials.refresh(request)

Args:
    session (requests.Session): An instance :class:`requests.Session` used
        to make HTTP requests. If not specified, a session will be created.

.. automethod:: __call__
Nc                 H    U(       d  [         R                  " 5       nXl        g r   )rN   Sessionsession)r   rU   s     r   r   Request.__init__   s    &&(Gr   c                      [        U S5      (       a)  U R                  b  U R                  R                  5         g g g ! [         a     g f = f)NrU   )hasattrrU   close	TypeErrorr   s    r   __del__Request.__del__   sJ    	tY''DLL,D""$ -E' 	 		s   8= 
A
	A
GETc                 D    [         R                  " [        X!X45        U R                  R                  " X!4X4US.UD6n[         R
                  " [        U5        [        U5      $ ! [        R                  R                   a  n[        R                  " U5      n	XeSnAff = f)a  Make an HTTP request using requests.

Args:
    url (str): The URI to be requested.
    method (str): The HTTP method to use for the request. Defaults
        to 'GET'.
    body (bytes): The payload or body in HTTP request.
    headers (Mapping[str, str]): Request headers.
    timeout (Optional[int]): The number of seconds to wait for a
        response from the server. If not specified or if None, the
        requests default timeout will be used.
    kwargs: Additional arguments passed through to the underlying
        requests :meth:`~requests.Session.request` method.

Returns:
    google.auth.transport.Response: The HTTP response.

Raises:
    google.auth.exceptions.TransportError: If any exception occurred.
r#   r   r4   N)r   request_log_LOGGERrU   requestresponse_logr   rN   r   RequestExceptionTransportError)
r   urlmethodbodyr   r4   kwargsr   
caught_excnew_excs
             r   __call__Request.__call__   s    :		*  &tE||++"&LRH !!'84X&&""33 	* //
;G)	*s   A!A$ $BBB)rU   r   )
r%   r&   r'   r(   r)   r   r[   _DEFAULT_TIMEOUTrl   r+   r,   r   r   rQ   rQ   t   s$    .  &*r   rQ   c                   D   ^  \ rS rSrSrU 4S jrU 4S jrU 4S jrSrU =r	$ )_MutualTlsAdapter   a  
A TransportAdapter that enables mutual TLS.

Args:
    cert (bytes): client certificate in PEM format
    key (bytes): client private key in PEM format

Raises:
    ImportError: if certifi or pyOpenSSL is not installed
    OpenSSL.crypto.Error: if client cert or key is invalid
c                   > SS K nSSKJn  SS KnUR                  R
                  R                  5         UR                  UR                  U5      nUR                  UR                  U5      n[        5       nUR                  UR                  5       S9  UR                  R                  U5        UR                  R                  U5        Xl        [        5       n	U	R                  UR                  5       S9  U	R                  R                  U5        U	R                  R                  U5        Xl        [$        [&        U ]S  5         g )Nr   )cryptocafile)certifiOpenSSLrs   urllib3.contrib.pyopensslcontrib	pyopensslinject_into_urllib3load_privatekeyFILETYPE_PEMload_certificater   load_verify_locationswhere_ctxuse_certificateuse_privatekey_ctx_poolmanager_ctx_proxymanagersuperrp   r   )r   certkeyrv   rs   urllib3pkeyx509ctx_poolmanagerctx_proxymanager	__class__s             r   r   _MutualTlsAdapter.__init__   s    "(!!557%%f&9&93?&&v':':DA02--W]]_-E,,T2++D1 /13..gmmo.F--d3,,T2!1/1r   c                 L   > U R                   US'   [        [        U ]  " U0 UD6  g Nssl_context)r   r   rp   init_poolmanagerr   argsri   r   s      r   r   "_MutualTlsAdapter.init_poolmanager   s(     $ 5 5}7HHr   c                 J   > U R                   US'   [        [        U ]  " U0 UD6$ r   )r   r   rp   proxy_manager_forr   s      r   r   #_MutualTlsAdapter.proxy_manager_for   s+     $ 6 6}&?PPPr   )r   r   
r%   r&   r'   r(   r)   r   r   r   r+   __classcell__r   s   @r   rp   rp      s    
20IQ Qr   rp   c                   D   ^  \ rS rSrSrU 4S jrU 4S jrU 4S jrSrU =r	$ )_MutualTlsOffloadAdapter   aS  
A TransportAdapter that enables mutual TLS and offloads the client side
signing operation to the signing library.

Args:
    enterprise_cert_file_path (str): the path to a enterprise cert JSON
        file. The file should contain the following field:

            {
                "libs": {
                    "signer_library": "...",
                    "offload_library": "..."
                }
            }

Raises:
    ImportError: if certifi or pyOpenSSL is not installed
    google.auth.exceptions.MutualTLSChannelError: If mutual TLS channel
        creation failed for any reason.
c                   > SS K nSSKJn  UR                  U5      U l        U R                  R                  5         SS KnUR                  R                  R                  5         [        5       nUR                  UR                  5       S9  U R                  R                  U5        XPl        [        5       nUR                  UR                  5       S9  U R                  R                  U5        X`l        [         ["        U ]K  5         g )Nr   )_custom_tls_signerrt   )rv   google.auth.transportr   CustomTlsSignersignerload_librariesrx   ry   rz   r{   r   r   r   attach_to_ssl_contextr   r   r   r   r   )r   enterprise_cert_file_pathrv   r   r   poolmanagerproxymanagerr   s          r   r   !_MutualTlsOffloadAdapter.__init__	  s    <(889RS""$(!!557,.)))A))+6 +-/**'--/*B)),7!-&68r   c                 L   > U R                   US'   [        [        U ]  " U0 UD6  g r   )r   r   r   r   r   s      r   r   )_MutualTlsOffloadAdapter.init_poolmanager   s(     $ 5 5}&>OOr   c                 J   > U R                   US'   [        [        U ]  " U0 UD6$ r   )r   r   r   r   r   s      r   r   *_MutualTlsOffloadAdapter.proxy_manager_for$  s,     $ 6 6}-tFWPVWWr   )r   r   r   r   r   s   @r   r   r      s    *9.PX Xr   r   c                      ^  \ rS rSrSr\R                  \R                  SSS4U 4S jjrS
S jr	SSS\
4U 4S jjr\S 5       rU 4S jrS	rU =r$ )AuthorizedSessioni)  a  A Requests Session class with credentials.

This class is used to perform requests to API endpoints that require
authorization::

    from google.auth.transport.requests import AuthorizedSession

    authed_session = AuthorizedSession(credentials)

    response = authed_session.request(
        'GET', 'https://www.googleapis.com/storage/v1/b')


The underlying :meth:`request` implementation handles adding the
credentials' headers to the request and refreshing credentials as needed.

This class also supports mutual TLS via :meth:`configure_mtls_channel`
method. In order to use this method, the `GOOGLE_API_USE_CLIENT_CERTIFICATE`
environment variable must be explicitly set to ``true``, otherwise it does
nothing. Assume the environment is set to ``true``, the method behaves in the
following manner:

If client_cert_callback is provided, client certificate and private
key are loaded using the callback; if client_cert_callback is None,
application default SSL credentials will be used. Exceptions are raised if
there are problems with the certificate, private key, or the loading process,
so it should be called within a try/except block.

First we set the environment variable to ``true``, then create an :class:`AuthorizedSession`
instance and specify the endpoints::

    regular_endpoint = 'https://pubsub.googleapis.com/v1/projects/{my_project_id}/topics'
    mtls_endpoint = 'https://pubsub.mtls.googleapis.com/v1/projects/{my_project_id}/topics'

    authed_session = AuthorizedSession(credentials)

Now we can pass a callback to :meth:`configure_mtls_channel`::

    def my_cert_callback():
        # some code to load client cert bytes and private key bytes, both in
        # PEM format.
        some_code_to_load_client_cert_and_key()
        if loaded:
            return cert, key
        raise MyClientCertFailureException()

    # Always call configure_mtls_channel within a try/except block.
    try:
        authed_session.configure_mtls_channel(my_cert_callback)
    except:
        # handle exceptions.

    if authed_session.is_mtls:
        response = authed_session.request('GET', mtls_endpoint)
    else:
        response = authed_session.request('GET', regular_endpoint)


You can alternatively use application default SSL credentials like this::

    try:
        authed_session.configure_mtls_channel()
    except:
        # handle exceptions.

Args:
    credentials (google.auth.credentials.Credentials): The credentials to
        add to the request.
    refresh_status_codes (Sequence[int]): Which HTTP status codes indicate
        that credentials should be refreshed and the request should be
        retried.
    max_refresh_attempts (int): The maximum number of times to attempt to
        refresh the credentials and retry the request.
    refresh_timeout (Optional[int]): The timeout value in seconds for
        credential refresh HTTP requests.
    auth_request (google.auth.transport.requests.Request):
        (Optional) An instance of
        :class:`~google.auth.transport.requests.Request` used when
        refreshing credentials. If not passed,
        an instance of :class:`~google.auth.transport.requests.Request`
        is created.
    default_host (Optional[str]): A host like "pubsub.googleapis.com".
        This is used when a self-signed JWT is created from service
        account credentials.
Nc                 H  > [         [        U ]  5         Xl        X l        X0l        X@l        SU l        X`l        Uci  [        R                  " 5       U l        [        R                  R                  SS9nU R                  R                  SU5        [        U R                  5      nOS U l        XPl        [#        U R                  [$        R&                  5      (       aH  U R                  R)                  U R                  (       a  SR+                  U R                  5      OS 5        g g )NF   )max_retrieshttps://zhttps://{}/)r   r   r   credentials_refresh_status_codes_max_refresh_attempts_refresh_timeout_is_mtls_default_hostrN   rT   _auth_request_sessionadaptersHTTPAdaptermountrQ   _auth_requestrC   r	   Credentials_create_self_signed_jwtformat)	r   r   refresh_status_codesmax_refresh_attemptsrefresh_timeoutauth_requestdefault_hostretry_adapterr   s	           r   r   AuthorizedSession.__init__  s     	/1&%9"%9" /))1)9)9);D&
 %--99a9HM&&,,ZG #4#=#=>L)-D& * d&&(C(CDD44<@<N<N$$T%7%78TX Er   c                 >   [         R                  " [        R                  S5      nUS:w  a  SU l        g SSKn [        R                  R                  R                  R                  U5      u  U l        nnU R                  (       a  [        Xg5      nU R                  SU5        gg! [         a  n[        R                  " U5      nXTeSnAff = f! [        R                   [        UR"                  R$                  4 a  n[        R                  " U5      nXTeSnAff = f)a  Configure the client certificate and key for SSL connection.

The function does nothing unless `GOOGLE_API_USE_CLIENT_CERTIFICATE` is
explicitly set to `true`. In this case if client certificate and key are
successfully obtained (from the given client_cert_callback or from application
default SSL credentials), a :class:`_MutualTlsAdapter` instance will be mounted
to "https://" prefix.

Args:
    client_cert_callback (Optional[Callable[[], (bytes, bytes)]]):
        The optional callback returns the client certificate and private
        key bytes both in PEM format.
        If the callback is None, application default SSL credentials
        will be used.

Raises:
    google.auth.exceptions.MutualTLSChannelError: If mutual TLS channel
        creation failed for any reason.
falsetrueFNr   r   )osgetenvr   !GOOGLE_API_USE_CLIENT_CERTIFICATEr   rw   ImportErrorr   MutualTLSChannelErrorgoogleauthr   _mtls_helperget_client_cert_and_keyrp   r   ClientCertErrorrs   Error)	r   client_cert_callbackuse_client_certrw   rj   rk   r   r   mtls_adapters	            r   configure_mtls_channel(AuthorizedSession.configure_mtls_channel  s   ( ))>>
 f$!DM	*
	*
 %%22JJ$	
 }}0;

:|4   	* 66zBG)	*" &&NN  
 	*
 !66zBG)	*s/   B& A*C &
C0CC/D?DDc           	         > UR                  SS5      nUb  UR                  5       O0 n	Uc  U R                  O[        R                  " U R                  US9n
Un[        U5       nU R                  R                  XX)5        SSS5        WR                  n[        U5       n[        R                  " [        XX45        [        [        U ]:  " UU4UU	US.UD6nSSS5        UR                  nWR                  U R                   ;   a  XR"                  :  a  [        R%                  SUR                  US-   U R"                  5        Uc  U R                  O[        R                  " U R                  US9n
[        U5       nU R                  R'                  U
5        SSS5        UR                  nU R                  " UU4UUUUUS-   S.UD6$ U$ ! , (       d  f       GNQ= f! , (       d  f       GN= f! , (       d  f       N]= f)	a  Implementation of Requests' request.

Args:
    timeout (Optional[Union[float, Tuple[float, float]]]):
        The amount of time in seconds to wait for the server response
        with each individual request. Can also be passed as a tuple
        ``(connect_timeout, read_timeout)``. See :meth:`requests.Session.request`
        documentation for details.
    max_allowed_time (Optional[float]):
        If the method runs longer than this, a ``Timeout`` exception is
        automatically raised. Unlike the ``timeout`` parameter, this
        value applies to the total method execution time, even if
        multiple requests are made under the hood.

        Mind that it is not guaranteed that the timeout error is raised
        at ``max_allowed_time``. It might take longer, for example, if
        an underlying request takes a lot of time, but the request
        itself does not timeout, e.g. if a large file is being
        transmitted. The timout error will be raised after such
        request completes.
_credential_refresh_attemptr   N)r4   r_   z;Refreshing credentials due to a %s response. Attempt %s/%s.   )r#   r   max_allowed_timer4   r   )popcopyr   	functoolspartialr.   r   before_requestr2   r   r`   ra   r   r   rb   r   r   r   inforefresh)r   rg   rf   r#   r   r   r4   ri   r   request_headersr   remaining_timeguardr   r   s                 r   rb   AuthorizedSession.request  s   L '-jj1NPQ&R# -4,?',,.R  ""4#5#5wG 	 *.)U++L#W *00.)U  &tE.= ' H * 00   D$>$>>+.H.HH LLM$$+a/**	 ? ""&&t'9'97K  n-  ((6 ."44N <<	 !/,G!,K	 	 	 u *) *)J .-s$   $G 7G<G/
G
G,/
G=c                     U R                   $ )z3Indicates if the created SSL channel is mutual TLS.)r   r   s    r   is_mtlsAuthorizedSession.is_mtlsR  s     }}r   c                 x   > U R                   b  U R                   R                  5         [        [        U ]  5         g r   )r   rY   r   r   )r   r   s    r   rY   AuthorizedSession.closeW  s/    %%1&&,,.,.r   )r   r   r   r   r   r   r   r   r   )r%   r&   r'   r(   r)   r   DEFAULT_REFRESH_STATUS_CODESDEFAULT_MAX_REFRESH_ATTEMPTSr   r   rn   rb   r*   r   rY   r+   r   r   s   @r   r   r   )  sf    Tr 'CC&CC)V3*r  pd  / /r   r   )'r)   
__future__r   r   loggingrD   r   r8   rN   r   rj   requests.adaptersrequests.exceptions#requests.packages.urllib3.util.ssl_r   google.authr   r   r   r   "google.auth.transport._mtls_helperr   google.oauth2r	   	getLoggerr%   ra   rn   Responser   objectr.   rQ   r   r   rp   r   rT   r   r,   r   r   <module>r      s    & &    	 
   ! ( " ! ) )


H
% &	"" &.)-6 )-XN*i N*b+Q))55 +Q\3Xx00<< 3Xlq/(( q/]  
ws   C/ /D5	C>>D