
    gz                         d Z ddlmZ ddlZddlZddl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)	z9Transport adapter for http.client, for internal use only.    N)
exceptions)	transportc                   F    e Zd ZdZd Zed        Zed        Zed        Zy)Responsezhttp.client transport response adapter.

    Args:
        response (http.client.HTTPResponse): The raw http client response.
    c                     |j                   | _        |j                         D ci c]  \  }}|j                         | c}}| _        |j                         | _        y c c}}w N)status_status
getheaderslower_headersread_data)selfresponsekeyvalues       W/var/www/openai/venv/lib/python3.12/site-packages/google/auth/transport/_http_client.py__init__zResponse.__init__#   sP    >F>Q>Q>ST>S
Ue+>ST]]_
 Us   Ac                     | j                   S r   )r
   r   s    r   r	   zResponse.status(   s    ||    c                     | j                   S r   )r   r   s    r   headerszResponse.headers,   s    }}r   c                     | j                   S r   )r   r   s    r   datazResponse.data0   s    zzr   N)	__name__
__module____qualname____doc__r   propertyr	   r   r    r   r   r   r      sH    %
      r   r   c                       e Zd ZdZ	 ddZy)Requestz&http.client transport request adapter.Nc                    |t         j                  }|i }t        j                  j	                  |      }t        j                  j                  dd|j                  |j                  |j                  f      }|j                  dk7  r.t        j                  dj                  |j                              t        j                  |j                  |      }		 t         j#                  d||        |	j$                  ||f||d| |	j'                         }
t)        |
      |	j+                          S # t        j,                  t         j.                  f$ r}t        j                  |      }||d}~ww xY w# |	j+                          w xY w)a;  Make an HTTP request using http.client.

        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 / body in HTTP request.
            headers (Mapping): Request headers.
            timeout (Optional(int)): The number of seconds to wait for a
                response from the server. If not specified or if None, the
                socket global default timeout will be used.
            kwargs: Additional arguments passed throught to the underlying
                :meth:`~http.client.HTTPConnection.request` method.

        Returns:
            Response: The HTTP response.

        Raises:
            google.auth.exceptions.TransportError: If any exception occurred.
        N httpzDhttp.client transport only supports the http scheme, {}was specified)timeoutzMaking request: %s %s)bodyr   )socket_GLOBAL_DEFAULT_TIMEOUTurllibparseurlsplit
urlunsplitpathqueryfragmentschemer   TransportErrorformathttp_clientHTTPConnectionnetloc_LOGGERdebugrequestgetresponser   closeHTTPExceptionerror)r   urlmethodr)   r   r(   kwargspartsr0   
connectionr   
caught_excnew_excs                r   __call__zRequest.__call__8   sP   0 ?44G ?G %%c*||&&UZZenn=
 <<6!++  &u|| 4 
 !//gN
	MM163?JvtR$R6R!--/HH%  ))6<<8 	* //
;Gz)	*
 s%   AD0 0#E0E++E00E3 3F)GETNNN)r   r   r   r    rG   r"   r   r   r$   r$   5   s    0 CG9r   r$   )r    http.clientclientr6   loggingr*   r,   google.authr   r   	getLoggerr   r9   r   r$   r"   r   r   <module>rN      sS    @ !    " !
'

H
%y!! 2<i <r   