Ë
    ùmxiD  ã                   ó
  — d Z ddlZddlZddlmZmZmZ 	 ddlZddl
mZ ddl
mZ ddlmZ ddlmZ  ej                   e«      Z G d„ d	ej&                  «      Z G d
„ dej(                  «      Zy# e$ rZ	 ed«      e	‚dZ	[	ww xY w)zCTransport adapter for Asynchronous HTTP Requests based on aiohttp.
é    N)ÚAsyncGeneratorÚMappingÚOptionalzjThe aiohttp library is not installed from please install the aiohttp package to use the aiohttp transport.)Ú_helpers)Ú
exceptions)Ú	transportc                   óÊ  — 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y)Ú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                 ó   — || _         y ©N)Ú	_response)Úselfr   s     úX/home/htdocs/ttos/venv/lib/python3.12/site-packages/google/auth/aio/transport/aiohttp.pyÚ__init__zResponse.__init__1   s	   € Ø!ˆ�ó    Úreturnc                 ó.   — | j                   j                  S r   )r   Ústatus©r   s    r   Ústatus_codezResponse.status_code4   s   € ð �~‰~×$Ñ$Ð$r   c                 ó~   — | j                   j                  j                  «       D ��ci c]  \  }}||“Œ
 c}}S c c}}w r   )r   ÚheadersÚitems)r   ÚkeyÚvalues      r   r   zResponse.headers9   s3   € ð .2¯^©^×-CÑ-C×-IÑ-IÓ-K×L™z˜s E��U‘
ÓLÐLùÓLs   ¨9Ú
chunk_sizeNc                óÞ   K  — 	 | j                   j                  j                  |«      2 3 d {  –—† }|­–— Œ7 Œ
6 y # t        j                  $ r}t        j                  d«      |‚d }~ww xY w­w)Nz'Failed to read from the payload stream.)r   ÚcontentÚiter_chunkedÚaiohttpÚClientPayloadErrorr   ÚResponseError)r   r   ÚchunkÚexcs       r   r   zResponse.content>   st   è ø€ ð	Ø#Ÿ~™~×5Ñ5×BÑBØó ÷ ð �eð ”ðøñ  øô ×)Ñ)ò 	Ü×*Ñ*Ø9óàðûð	üs=   ‚A-„%< ©:­8®:±< ¸:º< »A-¼A*ÁA%Á%A*Á*A-c              ƒ   ó¶   K  — 	 | j                   j                  «       ƒ d {  –—† S 7 Œ# t        j                  $ r}t	        j
                  d«      |‚d }~ww xY w­w)Nz!Failed to read the response body.)r   Úreadr!   ÚClientResponseErrorr   r#   )r   r%   s     r   r'   zResponse.readJ   sQ   è ø€ ð	YØŸ™×,Ñ,Ó.×.Ð.Ð.ùÜ×*Ñ*ò 	YÜ×*Ñ*Ð+NÓOÐUXÐXûð	Yüs0   ‚A„( ¡&¢( ¥A¦( ¨A»AÁAÁAc              ƒ   ó@   K  — | j                   j                  «        y ­wr   )r   Úcloser   s    r   r*   zResponse.closeQ   s   è ø€ à�‰×ÑÕùs   ‚)i   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r!   ÚClientResponser   Úpropertyr   Úcopy_docstringr   r
   Úintr   r   Ústrr   r   Úbytesr   r'   r*   © r   r   r
   r
   %   s'  „ ñ	ð" ×!7Ñ!7ó "ð Ø€X×Ñ˜Y×/Ñ/Ó0ð%˜Sò %ó 1ó ð%ð Ø€X×Ñ˜Y×/Ñ/Ó0ðM˜  c Ñ*ò Mó 1ó ðMð €X×Ñ˜Y×/Ñ/Ó0ñ	¨ð 	°~ÀeÈTÀkÑ7Rò 	ó 1ð	ð €X×Ñ˜Y×/Ñ/Ó0ðY˜Eò Yó 1ðYð €X×Ñ˜Y×/Ñ/Ó0ñó 1ñr   r
   c                   ó¢   — e Zd ZdZdd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dej                  fd„Zdd„Zy)Ú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| _        y )NF)Ú_sessionÚ_closed)r   r8   s     r   r   zRequest.__init__t   s   € ØˆŒØˆ�r   ÚGETÚurlÚmethodÚbodyr   Útimeoutr   c              ‹   ó†  K  — 	 | j                   rt        j                  d«      ‚| j                  st	        j
                  «       | _        t	        j                  |¬«      }t        j                  t        ||||«        | j                  j                  ||f|||dœ|¤Žƒ d{  –—† }t        j                  t        |«      ƒ d{  –—†  t        |«      S 7 Œ17 Œ# t        j                  $ r!}	t        j                  d|› d�«      }
|
|	‚d}	~	wt        j                   $ r!}	t        j                   d|› d�«      }||	‚d}	~	ww xY w­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   r@   NzFailed to send request to ú.zRequest timed out after z	 seconds.)r;   r   ÚTransportErrorr:   r!   ÚClientSessionÚClientTimeoutr   Úrequest_logÚ_LOGGERÚrequestÚ_helpers_asyncÚresponse_log_asyncr
   ÚClientErrorÚasyncioÚTimeoutError)r   r=   r>   r?   r   r@   ÚkwargsÚclient_timeoutr   Ú
caught_excÚ
client_excÚtimeout_excs               r   Ú__call__zRequest.__call__x   s<  è ø€ ðD	.Ø�|Š|Ü ×/Ñ/Ð0DÓEÐEà—=’=Ü '× 5Ñ 5Ó 7�”ä$×2Ñ2¸ÔAˆNÜ× Ñ ¤¨&°#°t¸WÔEØ2˜TŸ]™]×2Ñ2ØØðð ØØ&ñð ñ÷ ˆHô !×3Ñ3´G¸XÓF×FÐFÜ˜HÓ%Ð%ðøð Gùô ×"Ñ"ò 	-Ü#×2Ñ2Ð5OÐPSÈuÐTUÐ3VÓWˆJØ *Ð,ûä×#Ñ#ò 	.Ü$×1Ñ1Ø*¨7¨)°9Ð=óˆKð  :Ð-ûð		.üsY   ‚E„BC Â"CÂ#!C ÃCÃC ÃEÃC ÃC ÃD>Ã+DÄD>ÄD9Ä9D>Ä>Ec              ƒ   ó’   K  — | j                   s.| j                  r"| j                  j                  «       ƒ d{  –—†  d| _         y7 Œ­w)zY
        Close the underlying aiohttp session to release the acquired resources.
        NT)r;   r:   r*   r   s    r   r*   zRequest.close¸   s7   è ø€ ð �|Š| §¢Ø—-‘-×%Ñ%Ó'×'Ð'Øˆ�ð (ús   ‚6A¸A¹Ar   )r   N)r+   r,   r-   r.   r!   rF   r   r   Ú_DEFAULT_TIMEOUT_SECONDSr3   r   r4   r   Úfloatr
   rU   r*   r5   r   r   r7   r7   V   sŠ   „ ññ: × 5Ñ 5ó ð Ø $Ø/3Ø"×;Ñ;ñ>.àð>.ð ð>.ð �u‰oð	>.ð
 ˜' # s (Ñ+Ñ,ð>.ð ð>.ð 
×	Ñ	ó>.ô@r   r7   )r.   rN   ÚloggingÚtypingr   r   r   r!   ÚImportErrorrR   Úgoogle.authr   r   Úgoogle.auth.aiorK   r   Ú	getLoggerr+   rI   r
   r7   r5   r   r   ú<module>r_      s�   ðñó Û ß 4Ñ 4ðÛõ !Ý "Ý 6Ý %à
ˆ'×
Ñ
˜HÓ
%€ô.ˆy×!Ñ!ô .ôbhˆi×Ñõ høð} ò Ù
Øtóàðûðús   –A/ Á/BÁ4	A=Á=B