§
    8?Äj¢+  ã                   óH  — d Z ddlZddlZddlmZmZmZmZmZ 	 ddl	Z	n# e
$ rZ e
d¦  «        e‚dZ[ww xY wddlmZmZ ddlmZ ddlmZ erddl	mZ n	 ddl	mZ n# e
ef$ r dZY nw xY w ej        e¦  «        Z G d	„ d
ej        ¦  «        Z G d„ dej        ¦  «        ZdS )zBTransport adapter for Asynchronous HTTP Requests based on aiohttp.é    N)ÚTYPE_CHECKINGÚAsyncGeneratorÚMappingÚOptionalÚUnionzjThe aiohttp library is not installed from please install the aiohttp package to use the aiohttp transport.)Ú_helpersÚ
exceptions)r   )Ú	transport)ÚClientTimeoutc                   ó²  — e Zd ZdZdej        fd„Ze ej	        e
j        ¦  «        defd„¦   «         ¦   «         Ze ej	        e
j        ¦  «        deeef         fd„¦   «         ¦   «         Z ej	        e
j        ¦  «        ddedeed	f         fd
„¦   «         Z ej	        e
j        ¦  «        defd„¦   «         Z ej	        e
j        ¦  «        d„ ¦   «         Zd	S )ÚResponseaz  
    Represents an HTTP response and its data. It is returned by ``google.auth.aio.transport.sessions.AsyncAuthorizedSession``.

    Args:
        response (aiohttp.ClientResponse): An instance of aiohttp.ClientResponse.

    Attributes:
        status_code (int): The HTTP status code of the response.
        headers (Mapping[str, str]): The HTTP headers of the response.
    Úresponsec                 ó   — || _         d S ©N)Ú	_response)Úselfr   s     úRC:\Projects\Historical\venv\Lib\site-packages\google/auth/aio/transport/aiohttp.pyÚ__init__zResponse.__init__8   s   € Ø!ˆŒˆˆó    Úreturnc                 ó   — | j         j        S r   )r   Ústatus©r   s    r   Ústatus_codezResponse.status_code;   s   € ð Œ~Ô$Ð$r   c                 óR   — d„ | j         j                             ¦   «         D ¦   «         S )Nc                 ó   — i | ]\  }}||“Œ	S © r   )Ú.0ÚkeyÚvalues      r   ú
<dictcomp>z$Response.headers.<locals>.<dictcomp>C   s   € ÐLÐLÐL™z˜s E��UÐLÐLÐLr   )r   ÚheadersÚitemsr   s    r   r"   zResponse.headers@   s*   € ð MÐL¨T¬^Ô-C×-IÒ-IÑ-KÔ-KÐLÑLÔLÐLr   é   Ú
chunk_sizeNc                ó¾   K  — 	 | j         j                             |¦  «        2 3 d {V —†}|W V — Œ6 d S # t          j        $ r}t          j        d¦  «        |‚d }~ww xY w)Nz'Failed to read from the payload stream.)r   ÚcontentÚiter_chunkedÚaiohttpÚClientPayloadErrorr	   ÚResponseError)r   r%   ÚchunkÚexcs       r   r'   zResponse.contentE   s¨   è è € ð	Ø#œ~Ô5×BÒBØñ ô  ð ð ð ð ð ð ð �eð �����ð ð  ð  øõ Ô)ð 	ð 	ð 	ÝÔ*Ø9ñô àðøøøøð	øøøs   „3 £0©3 ³AÁAÁAc              ƒ   óž   K  — 	 | j                              ¦   «         ƒ d {V —†S # t          j        $ r}t	          j        d¦  «        |‚d }~ww xY w)Nz!Failed to read the response body.)r   Úreadr)   ÚClientResponseErrorr	   r+   )r   r-   s     r   r/   zResponse.readQ   sm   è è € ð	YØœ×,Ò,Ñ.Ô.Ð.Ð.Ð.Ð.Ð.Ð.Ð.øÝÔ*ð 	Yð 	Yð 	YÝÔ*Ð+NÑOÔOÐUXÐXøøøøð	Yøøøs   „# £A²AÁAc              ƒ   ó<   K  — | j                              ¦   «          d S r   )r   Úcloser   s    r   r2   zResponse.closeX   s    è è € àŒ×ÒÑÔÐÐÐr   )r$   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r)   ÚClientResponser   Úpropertyr   Úcopy_docstringr
   r   Úintr   r   Ústrr"   r   Úbytesr'   r/   r2   r   r   r   r   r   ,   s„  € € € € € ð	ð 	ð" Ô!7ð "ð "ð "ð "ð Ø€XÔ˜YÔ/Ñ0Ô0ð%˜Sð %ð %ð %ñ 1Ô0ñ „Xð%ð Ø€XÔ˜YÔ/Ñ0Ô0ðM˜  c Ô*ð Mð Mð Mñ 1Ô0ñ „XðMð €XÔ˜YÔ/Ñ0Ô0ð	ð 	¨ð 	°~ÀeÈTÀkÔ7Rð 	ð 	ð 	ñ 1Ô0ð	ð €XÔ˜YÔ/Ñ0Ô0ðY˜Eð Yð Yð Yñ 1Ô0ðYð €XÔ˜YÔ/Ñ0Ô0ðð ñ 1Ô0ðð ð r   r   c                   ó¼   — e Zd ZdZddeej                 fd„Zdddej	        fde
de
dee         d	eee
e
f                  d
eeef         dej        fd„Zdd„Zdd„ZdS )ÚRequestaÔ  Asynchronous Requests request adapter.

    This class is used internally for making requests using aiohttp
    in a consistent way. If you use :class:`google.auth.aio.transport.sessions.AsyncAuthorizedSession`
    you do not need to construct or use this class directly.

    This class can be useful if you want to configure a Request callable
    with a custom ``aiohttp.ClientSession`` in :class:`AuthorizedSession` or if
    you want to manually refresh a :class:`~google.auth.aio.credentials.Credentials` instance::

        import aiohttp
        import google.auth.aio.transport.aiohttp

        # Default example:
        request = google.auth.aio.transport.aiohttp.Request()
        await credentials.refresh(request)

        # Custom aiohttp Session Example:
        session = session=aiohttp.ClientSession(auto_decompress=False)
        request = google.auth.aio.transport.aiohttp.Request(session=session)
        auth_session = google.auth.aio.transport.sessions.AsyncAuthorizedSession(auth_request=request)

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

    .. automethod:: __call__
    NÚsessionc                 ó"   — || _         d| _        d S )NF)Ú_sessionÚ_closed)r   r?   s     r   r   zRequest.__init__{   s   € ØˆŒØˆŒˆˆr   ÚGETÚurlÚmethodÚbodyr"   Útimeoutr   c              ‹   óº  K  — 	 | j         rt          j        d¦  «        ‚| j        st	          j        ¦   «         | _        t          |t          j        ¦  «        r|}nt	          j        |¬¦  «        }t          j	        t          ||||¦  «          | j        j        ||f|||dœ|¤Žƒ d{V —†}t          j        t          |¦  «        ƒ d{V —† t          |¦  «        S # t          j        $ r }	t          j        d|› d�¦  «        }
|
|	‚d}	~	wt           j        $ rD}	t          |t          j        ¦  «        r|j        }n|}t          j        d|› d�¦  «        }||	‚d}	~	ww xY w)	a÷  
        Make an HTTP request using aiohttp.

        Args:
            url (str): The URL to be requested.
            method (Optional[str]):
                The HTTP method to use for the request. Defaults to 'GET'.
            body (Optional[bytes]):
                The payload or body in HTTP request.
            headers (Optional[Mapping[str, str]]):
                Request headers.
            timeout (float): 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
                aiohttp :meth:`aiohttp.Session.request` method.

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

        Raises:
            - google.auth.exceptions.TransportError: If the request fails or if the session is closed.
            - google.auth.exceptions.TimeoutError: If the request times out.
        zsession is closed.)Útotal)Údatar"   rG   NzFailed to send request to ú.zRequest timed out after z	 seconds.)rB   r	   ÚTransportErrorrA   r)   ÚClientSessionÚ
isinstancer   r   Úrequest_logÚ_LOGGERÚrequestÚ_helpers_asyncÚresponse_log_asyncr   ÚClientErrorÚasyncioÚTimeoutErrorrI   )r   rD   rE   rF   r"   rG   ÚkwargsÚclient_timeoutr   Ú
caught_excÚ
client_excÚtimeout_secondsÚtimeout_excs                r   Ú__call__zRequest.__call__   sÇ  è è € ðD#	.ØŒ|ð FÝ Ô/Ð0DÑEÔEÐEà”=ð 8Ý 'Ô 5Ñ 7Ô 7�”å˜'¥7Ô#8Ñ9Ô9ð FØ!(��å!(Ô!6¸WÐ!EÑ!EÔ!E�ÝÔ ¥¨&°#°t¸WÑEÔEÐEØ2˜Tœ]Ô2ØØðð ØØ&ðð ð ðð ð ð ð ð ð ð ˆHõ !Ô3µG¸XÑFÔFÐFÐFÐFÐFÐFÐFÐFÝ˜HÑ%Ô%Ð%øåÔ"ð 	-ð 	-ð 	-Ý#Ô2Ð3VÐPSÐ3VÐ3VÐ3VÑWÔWˆJØ *Ð,øøøøåÔ#ð 	.ð 	.ð 	.Ý˜'¥7Ô#8Ñ9Ô9ð *Ø")¤-��à")�Ý$Ô1ØE¨?ÐEÐEÐEñô ˆKð  :Ð-øøøøð	.øøøs$   „CC ÃEÃ)DÄEÄ?EÅEc              ƒ   ór   K  — | j         s&| j        r| j                             ¦   «         ƒ d{V —† d| _         dS )zY
        Close the underlying aiohttp session to release the acquired resources.
        NT)rB   rA   r2   r   s    r   r2   zRequest.closeÆ   sL   è è € ð Œ|ð 	( ¤ð 	(Ø”-×%Ò%Ñ'Ô'Ð'Ð'Ð'Ð'Ð'Ð'Ð'ØˆŒˆˆr   c           
      ó>  — | j         rt          j        d¦  «        ‚| j        s&t	          j        dd¬¦  «        }t          |¬¦  «        S dt          | j        dd¦  «        dœ}t          | j        dd¦  «        }|�r6|j        �s.t          |t          j
        ¦  «        rkt	          j
        t          |d	d¦  «        t          |d
d¦  «        t          |dd¦  «        t          |dd¦  «        t          j        |¦  «        ¬¦  «        |d<   n©t          t          dd¦  «        rot          |t          t          d¦  «        ¦  «        rLt          |dd¦  «        }|r8t	          j        |t          |d
d¦  «        t          |dd¦  «        ¬¦  «        |d<   n$t          j        dt          |¦  «        › �¦  «        ‚t          | j        dd¦  «        }|rt          |¦  «        |d<   dD ]"\  }}t          | j        |d¦  «        }|�|||<   Œ#t          t	          j        di |¤Ž¬¦  «        S )a‡  Creates an independent copy of this request adapter.

        Clones the connection settings, trace configurations, and session defaults
        (headers, cookies, basic auth, and timeouts).

        Only standard `aiohttp.TCPConnector` and `aiohttp.UnixConnector` connectors
        are supported. The DNS resolver is not copied to avoid closing shared resolver
        resources.

        Returns:
            google.auth.aio.transport.aiohttp.Request: A new request adapter.

        Raises:
            google.auth.exceptions.TransportError: If the transport is closed, or if the
                session uses an unsupported connector.
        z Cannot clone a closed transport.FT)Úauto_decompressÚ	trust_env)r?   Ú
_trust_envÚ
_connectorNÚ_sslÚ_limitéd   Ú_limit_per_hostr   Ú_force_close)ÚsslÚlimitÚlimit_per_hostÚforce_closeÚ
local_addrÚ	connectorÚUnixConnectorÚ_path)Úpathrj   rl   z(Unsupported connector type for cloning: Ú_trace_configsÚtrace_configs))Ú_default_headersr"   )Ú_cookie_jarÚ
cookie_jar)Ú_default_authÚauth)Ú_timeoutrG   )Ú_json_serializeÚjson_serializer   )rB   r	   rL   rA   r)   rM   r>   ÚgetattrÚclosedrN   ÚTCPConnectorrR   Ú_get_local_addrro   ÚtypeÚlist)	r   Únew_sessionÚsession_kwargsÚorig_connectorrq   rs   Ú	attr_nameÚ
kwarg_nameÚvals	            r   Ú_clonezRequest._cloneÎ   sl  € ð" Œ<ð 	PÝÔ+Ð,NÑOÔOÐOàŒ}ð 	0Ý!Ô/Ø %Øðñ ô ˆKõ  ;Ð/Ñ/Ô/Ð/ð  %Ý  ¤°¸dÑCÔCð 
ð  
ˆõ ! ¤°¸dÑCÔCˆØñ 	 .Ô"7ñ 	Ý˜.­'Ô*>Ñ?Ô?ð õ /6Ô.BÝ °¸Ñ=Ô=Ý! .°(¸CÑ@Ô@Ý#*¨>Ð;LÈaÑ#PÔ#PÝ '¨¸ÈÑ NÔ NÝ-Ô=¸nÑMÔMð/ñ /ô /�˜{Ñ+Ð+õ � /°4Ñ8Ô8ð ½ZØ¥­°Ñ AÔ Añ>ô >ð õ ˜~¨w¸Ñ=Ô=�Øð Ý29Ô2GØ!Ý% n°hÀÑDÔDÝ$+¨N¸NÈEÑ$RÔ$Rð3ñ 3ô 3�N ;Ñ/øõ !Ô/ØU½tÀNÑ?SÔ?SÐUÐUñô ð õ
   ¤Ð/?ÀÑFÔFˆØð 	BÝ.2°=Ñ.AÔ.AˆN˜?Ñ+ð&
ð 		1ð 		1Ñ!ˆI�zõ ˜$œ-¨°DÑ9Ô9ˆCØˆØ-0�˜zÑ*øå�wÔ4ÐFÐF°~ÐFÐFÐGÑGÔGÐGr   r   )r   N)r   r>   )r3   r4   r5   r6   r   r)   rM   r   r
   Ú_DEFAULT_TIMEOUT_SECONDSr;   r<   r   r   Úfloatr   r   r]   r2   rˆ   r   r   r   r>   r>   ]   s	  € € € € € ðð ð:ð  ¨Ô)>Ô ?ð ð ð ð ð Ø $Ø/3Ø/8Ô/QðE.ð E.àðE.ð ðE.ð �uŒoð	E.ð
 ˜' # s (Ô+Ô,ðE.ð �u˜mÐ+Ô,ðE.ð 
Ô	ðE.ð E.ð E.ð E.ðNð ð ð ðNHð NHð NHð NHð NHð NHr   r>   )r6   rU   ÚloggingÚtypingr   r   r   r   r   r)   ÚImportErrorrY   Úgoogle.authr   r	   Úgoogle.auth.aiorR   r
   r   ÚAttributeErrorÚ	getLoggerr3   rP   r   r>   r   r   r   ú<module>r’      s¾  ðð IÐ Hà €€€Ø €€€Ø JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JðØ€N€N€N€NøØð ð ð Ø
ˆ+Øtñô àðøøøøðøøøð
 -Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø %Ð %Ð %Ð %Ð %Ð %àð Ø%Ð%Ð%Ð%Ð%Ð%Ð%ðØ)Ð)Ð)Ð)Ð)Ð)Ð)øØ˜Ð(ð ð ð Øˆˆˆðøøøð ˆ'Ô
˜HÑ
%Ô
%€ð.ð .ð .ð .ð .ˆyÔ!ñ .ô .ð .ðbHð Hð Hð Hð HˆiÔñ Hô Hð Hð Hð Hs"   š Ÿ5¤0°5ÁA Á	A)Á(A)