Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/site-packages/oauth2client/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/site-packages/oauth2client/__pycache__/transport.cpython-38.pyc
U

O��g(�@s�ddlZddlZddlZddlmZddlmZe�e�Z	dZ
ejfZGdd�de
�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Zdd�Zdddejdfdd�Ze�e��ZdS)�N)�http_client)�_helpers)�read�seek�tellc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�MemoryCachez8httplib2 Cache implementation which only caches locally.cCs
i|_dS�N��cache)�self�r�C/opt/cppython/lib/python3.8/site-packages/oauth2client/transport.py�__init__#szMemoryCache.__init__cCs|j�|�Sr)r
�get�r�keyrrr
r&szMemoryCache.getcCs||j|<dSrr	)rr�valuerrr
�set)szMemoryCache.setcCs|j�|d�dSr)r
�poprrrr
�delete,szMemoryCache.deleteN)�__name__�
__module__�__qualname__�__doc__rrrrrrrr
r s
rcCstS)aReturn an HTTP object which caches results returned.

    This is intended to be used in methods like
    oauth2client.client.verify_id_token(), which calls to the same URI
    to retrieve certs.

    Returns:
        httplib2.Http, an HTTP object with a MemoryCache
    )�_CACHED_HTTPrrrr
�get_cached_http0s
rcOstj||�S)a>Return a new HTTP object.

    Args:
        *args: tuple, The positional arguments to be passed when
               contructing a new HTTP object.
        **kwargs: dict, The keyword arguments to be passed when
                  contructing a new HTTP object.

    Returns:
        httplib2.Http, an HTTP object.
    )�httplib2�Http)�args�kwargsrrr
�get_http_object=sr cCs|dkriSt|�S)z�Creates a copy of the headers.

    Args:
        headers: dict, request headers to copy.

    Returns:
        dict, the copied headers or a new dictionary if the headers
        were None.
    N)�dict)�headersrrr
�_initialize_headersLs
r#cCs2|dk	r.d|kr&|d|d|d<n||d<|S)a,Adds a user-agent to the headers.

    Args:
        headers: dict, request headers to add / modify user
                 agent within.
        user_agent: str, the user agent to add.

    Returns:
        dict, the original headers passed in, but modified if the
        user agent is not None.
    Nz
user-agent� r)r"�
user_agentrrr
�_apply_user_agentYs
r&cCs�i}zTt�|�D]D\}}t|tj�s,t|�}t|tj�s@t|�}t�|�|t�|�<qWn,tk
r�ddlm	}||d|��YnX|S)a�Forces header keys and values to be strings, i.e not unicode.

    The httplib module just concats the header keys and values in a way that
    may make the message header a unicode string, which, if it then tries to
    contatenate to a binary request body may result in a unicode decode error.

    Args:
        headers: dict, A dictionary of headers.

    Returns:
        The same dictionary but with all the keys converted to strings.
    r)�NonAsciiHeaderErrorz: )
�six�	iteritems�
isinstance�binary_type�strr�	_to_bytes�UnicodeEncodeErrorZoauth2client.clientr')r"�clean�k�vr'rrr
�
clean_headersns
r2cs4|j�dddtjdf��fdd�	}||_�|j_dS)a�Prepares an HTTP object's request method for auth.

    Wraps HTTP requests with logic to catch auth failures (typically
    identified via a 401 status code). In the event of failure, tries
    to refresh the token used and then retry the original request.

    Args:
        credentials: Credentials, the credentials used to identify
                     the authenticated user.
        http: httplib2.Http, an http object to be used to make
              auth requests.
    �GETNc	s��jst�d�����t|�}��|�t|�j�d}t�fdd�t	D��rZ��
�}t�||�t|�||�\}}d}	t
|	�D]j}
|jtkr�q�t�d|j|
d|	�������|�|dk	rЈ�|�t�||�t|�||�\}}q�||fS)Nz1Attempting refresh to obtain initial access_tokenc3s|]}t�|d�VqdSr��getattr)�.0Zstream_prop��bodyrr
�	<genexpr>�sz:wrap_http_for_auth.<locals>.new_request.<locals>.<genexpr>�z&Refreshing due to a %s (attempt %s/%s)�)�access_token�_LOGGER�infoZ_refreshr#�applyr&r%�all�_STREAM_PROPERTIESr�requestr2�range�status�REFRESH_STATUS_CODESr)�uri�methodr8r"�redirections�connection_typeZbody_stream_position�resp�contentZmax_refresh_attemptsZrefresh_attempt��credentials�orig_request_methodr7r
�new_request�sF


�
�
�



�
z'wrap_http_for_auth.<locals>.new_request)rBr�DEFAULT_MAX_REDIRECTSrM�rM�httprOrrLr
�wrap_http_for_auth�s
�-rScsF|j�t�|�|j�dddtjdf���fdd�	}||_�|j_dS)aPrepares an HTTP object's request method for JWT access.

    Wraps HTTP requests with logic to catch auth failures (typically
    identified via a 401 status code). In the event of failure, tries
    to refresh the token used and then retry the original request.

    Args:
        credentials: _JWTAccessCredentials, the credentials used to identify
                     a service account that uses JWT access tokens.
        http: httplib2.Http, an http object to be used to make
              auth requests.
    r3Nc	s�d�jkr8�jdks�jr$��d�t�||||||�St|�}t|�j�|�dd�d}��	d|i�\}}d||d<t�|||t
|�||�SdS)NZaud�?r;rzBearer �
Authorization)�_kwargsr<Zaccess_token_expired�refreshrBr#r&r%�splitZ
_create_tokenr2)	rFrGr8r"rHrIZuri_root�tokenZ
unused_expiry�Zauthenticated_request_methodrMrNrr
rO�s,

�
�
�z-wrap_http_for_jwt_access.<locals>.new_request)rBrSrrPrMrQrrZr
�wrap_http_for_jwt_access�s

�r[r3cCs t|d|�}|||||||d�S)a�Make an HTTP request with an HTTP object and arguments.

    Args:
        http: httplib2.Http, an http object to be used to make requests.
        uri: string, The URI to be requested.
        method: string, The HTTP method to use for the request. Defaults
                to 'GET'.
        body: string, The payload / body in HTTP request. By default
              there is no payload.
        headers: dict, Key-value pairs of request headers. By default
                 there are no headers.
        redirections: int, The number of allowed 203 redirects for
                      the request. Defaults to 5.
        connection_type: httplib.HTTPConnection, a subclass to be used for
                         establishing connection. If not set, the type
                         will be determined from the ``uri``.

    Returns:
        tuple, a pair of a httplib2.Response with the status code and other
        headers and the bytes of the content returned.
    rB)rGr8r"rHrIr4)rRrFrGr8r"rHrIZ
http_callablerrr
rB�s

�rB)�loggingrr(Z	six.movesrZoauth2clientr�	getLoggerrr=rA�UNAUTHORIZEDrE�objectrrr r#r&r2rSr[rPrBrrrrrr
�<module>s(


C2�


F1le Man4ger