3 fYY@svdZddlZddlZddlmZddlmZddlmZddlmZej e Z Gdddej Z Gd d d ej Z dS) z9Transport adapter for http.client, for internal use only.N) http_client)urllib) exceptions) transportc@s<eZdZdZddZeddZeddZedd Zd S) Responsezhttp.client transport response adapter. Args: response (http.client.HTTPResponse): The raw http client response. cCs*|j|_dd|jD|_|j|_dS)NcSsi|]\}}||jqS)lower).0keyvaluerrS/Users/olari/OneDrive/sandbox/awsBlog2/lambda/google/auth/transport/_http_client.py %sz%Response.__init__..)status_status getheaders_headersread_data)selfresponserrr __init__#szResponse.__init__cCs|jS)N)r)rrrr r)szResponse.statuscCs|jS)N)r)rrrr headers-szResponse.headerscCs|jS)N)r)rrrr data1sz Response.dataN) __name__ __module__ __qualname____doc__rpropertyrrrrrrr rs   rc@seZdZdZdddZdS)Requestz&http.client transport request adapter.GETNc Ks|dkrtj}|dkri}tjj|}tjjdd|j|j|jf}|j dkr^t j dj |j t j|j|d} zry8tjd||| j||f||d|| j} t| St jtjfk r} zt j | WYdd} ~ XnXWd| jXdS)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. NhttpzDhttp.client transport only supports the http scheme, {}was specified)timeoutzMaking request: %s %s)bodyr)socket_GLOBAL_DEFAULT_TIMEOUTrparseurlsplit urlunsplitpathqueryfragmentschemerTransportErrorformatrHTTPConnectionnetloc_LOGGERdebugrequest getresponser HTTPExceptionerrorclose) rurlmethodr#rr"kwargspartsr) connectionrexcrrr __call__9s*    zRequest.__call__)rNNN)rrrrr>rrrr r6sr)rloggingr$ six.movesrr google.authrr getLoggerrr1rrrrrr s