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/contrib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


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

O��g�@s�dZddlZddlZddlZddlZddlmZddlmZdZGdd�de	�Z
Gdd	�d	e
�ZGd
d�de
�ZdZ
Gd
d�de�Zdd�ZGdd�dej�ZdS)z;OAuth 2.0 utitilies for Google Developer Shell environment.�N)�_helpers)�clientZDEVSHELL_CLIENT_PORTc@seZdZdZdS)�ErrorzErrors for this module.N��__name__�
__module__�__qualname__�__doc__�r
r
�J/opt/cppython/lib/python3.8/site-packages/oauth2client/contrib/devshell.pyrsrc@seZdZdZdS)�CommunicationErrorz9Errors for communication with the Developer Shell server.Nrr
r
r
rr!src@seZdZdZdS)�NoDevshellServerz6Error when no Developer Shell server can be contacted.Nrr
r
r
rr
%sr
z[]c@seZdZdZdd�ZdS)�CredentialInfoResponsea�Credential information response from Developer Shell server.

    The credential information response from Developer Shell socket is a
    PBLite-formatted JSON array with fields encoded by their index in the
    array:

    * Index 0 - user email
    * Index 1 - default project ID. None if the project context is not known.
    * Index 2 - OAuth2 access token. None if there is no valid auth context.
    * Index 3 - Seconds until the access token expires. None if not present.
    cCs�t�|�}t|t�s$tdt|���t|�}|dkr<|dnd|_|dkrR|dnd|_|dkrh|dnd|_	|dkr~|dnd|_
dS)z4Initialize the response data from JSON PBLite array.zNot a list: rN���)�json�loads�
isinstance�list�
ValueError�str�len�
user_email�
project_id�access_token�
expires_in)�selfZjson_stringZpblZpbl_lenr
r
r�__init__<s

zCredentialInfoResponse.__init__N)rrrr	rr
r
r
rr/srcCs�tt�td��}|dkrt��t��}|�d|f�t}d�t	|�|�}|�
tj|dd��|�
d���}d|krztd��|�dd	�\}}t|�t	|�}|dkr�||�
|tj���7}t|�S)
z3Communicate with the Developer Shell server socket.r�	localhostz{0}
{1}zutf-8)�encoding��
z#saw no newline in the first 6 bytesr)�int�os�getenv�DEVSHELL_ENVr
�socket�connect�CREDENTIAL_INFO_REQUEST_JSON�formatr�sendallr�	_to_bytes�recv�decoder�split�MSG_WAITALLr)�port�sock�data�msg�header�len_strZjson_strZto_readr
r
r�	_SendRecvHs r7csZeZdZdZd�fdd�	Zdd�Zedd��Zed	d
��Ze	dd��Z
ed
d��Z�ZS)�DevshellCredentialsa�Credentials object for Google Developer Shell environment.

    This object will allow a Google Developer Shell session to identify its
    user to Google and other OAuth 2.0 servers that can verify assertions. It
    can be used for the purpose of accessing data stored under the user
    account.

    This credential does not require a flow to instantiate because it
    represents a two legged flow, and therefore has all of the required
    information to generate and refresh its own access tokens.
    Nc	s*tt|��dddddd|�|�d�dS�N)�superr8r�_refresh)r�
user_agent��	__class__r
rrns
�zDevshellCredentials.__init__cCsHt�|_|jj|_|jj}|dk	r>tj|d�}t��||_nd|_dS)zXRefreshes the access token.

        Args:
            http: unused HTTP object
        N)�seconds)	r7�devshell_responserr�datetime�	timedeltarZ_UTCNOWZtoken_expiry)r�httpr�deltar
r
rr;ys
zDevshellCredentials._refreshcCs|jjSr9)r@r�rr
r
rr�szDevshellCredentials.user_emailcCs|jjSr9)r@rrEr
r
rr�szDevshellCredentials.project_idcCstd��dS)Nz2Cannot load Developer Shell credentials from JSON.��NotImplementedError)�clsZ	json_datar
r
r�	from_json�s�zDevshellCredentials.from_jsoncCstd��dS)Nz-Cannot serialize Developer Shell credentials.rFrEr
r
r�serialization_data�s�z&DevshellCredentials.serialization_data)N)
rrrr	rr;�propertyrr�classmethodrIrJ�
__classcell__r
r
r=rr8as


r8)r	rArr$r'Zoauth2clientrrr&�	Exceptionrrr
r)�objectrr7ZGoogleCredentialsr8r
r
r
r�<module>s

F1le Man4ger