File manager - Edit - /home/u478019808/domains/bestandroidphones.store/public_html/static/img/logo/gcs_oauth2_boto_plugin.zip
Back
PK �+�Z}�� � ( __pycache__/oauth2_helper.cpython-39.pycnu �[��� a ��3f\! � @ s� d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl m Z ddlZddl mZ dZdadadZdZd Zd Ze jjfdd�Zddd�Zdd� Zdd� ZdS )z3Helper routines to facilitate use of oauth2_client.� )�absolute_importN)� oauth2_client)�inputzutf-8z)https://accounts.google.com/o/oauth2/authz#https://oauth2.googleapis.com/token� notasecretzurn:ietf:wg:oauth:2.0:oobc C s� d}| � ddd�}|dkrF| �dd�r<tj| � dd�d�}qdt�� }n|dkrXt�� }ntd| ��d}d}d}d}| �d d �r�| �d d�r�| � d d �}t| � d d��}| � d dd�}| � d d d�}| � ddt�}| � ddt�} |tj j k�r,| � ddd�} | � ddd�}t�|d��}|� � } W d � n1 �s60 Y d}z| �t�} d}W n t�yj Y n0 |�r�zt�| �}W n t�y� td| ��Y n0 dD ] }||v�r�td||f ���q�tj|||| | �d dd� ||||d� S | � ddt�}tj| | |||| | �d dd� ||||d�S n�|tj jk�r�| � ddtj� dt��}|�s`td��| � dd tj� d!t��}| �d d"�}|d#k�r�d}|�s�td$��tj| ||| � dd%�||| �d dd� |||||d&�S td'��dS )(zBCreate a client type based on credentials supplied in boto config.N�OAuth2�token_cache�file_systemZtoken_cache_path_pattern)�path_pattern� in_memoryz6Invalid value for config option OAuth2/token_cache: %s�Boto�proxy� proxy_port� proxy_user� proxy_pass�provider_authorization_uri�provider_token_uri�Credentials�gs_service_client_id� �gs_service_key_file�rbFTz/Could not parse JSON keyfile "%s" as valid JSON)� client_id�client_email�private_key_id�private_keyzFThe JSON private key file at %s did not contain the required entry: %s�https_validate_certificates)�access_token_cache�auth_uri� token_uri�"disable_ssl_certificate_validation� proxy_hostr r r �gs_service_key_file_passwordr �OAUTH2_CLIENT_IDz�client_id for your application obtained from https://console.developers.google.com must be set in a boto config or with OAUTH2_CLIENT_ID environment variable or with gcs_oauth2_boto_plugin.SetFallbackClientIdAndSecret function.� client_secret�OAUTH2_CLIENT_SECRET�ca_certificates_file�systemz�client_secret for your application obtained from https://console.developers.google.com must be set in a boto config or with OAUTH2_CLIENT_SECRET environment variable or with gcs_oauth2_boto_plugin.SetFallbackClientIdAndSecret function.�gs_oauth2_refresh_token)r r r r r r r � ca_certs_filezTYou have attempted to create an OAuth2 client without setting up OAuth2 credentials.)�get� has_optionr �FileSystemTokenCache�InMemoryTokenCache� Exception�int�(GOOGLE_OAUTH2_PROVIDER_AUTHORIZATION_URI� GOOGLE_OAUTH2_PROVIDER_TOKEN_URI� CredTypes�OAUTH2_SERVICE_ACCOUNT�io�open�read�decode�UTF8�UnicodeDecodeError�json�loads� ValueError�OAuth2JsonServiceAccountClient�getbool�#GOOGLE_OAUTH2_DEFAULT_FILE_PASSWORD�OAuth2ServiceAccountClient�OAUTH2_USER_ACCOUNT�os�environ� CLIENT_ID� CLIENT_SECRET� get_value�OAuth2UserAccountClient)�config� cred_typer Ztoken_cache_typer r r r r r �service_client_id�private_key_filename�private_key_filer �keyfile_is_utf8� json_key_dict� json_entry� key_file_passr r# r( � rP �V/opt/gsutil/third_party/gcs-oauth2-boto-plugin/gcs_oauth2_boto_plugin/oauth2_helper.py�OAuth2ClientFromBotoConfig, s� � �� ���( � � ����� ���� � �� rR Fc C s� t jj| j| j|| j| jtd�}|�� }|r>t j �d| � nt j �d| � t j �d� |r~tj |ddd�s~t j �d| � t�d � td �}|j|| �� d�}|jS )zHRun the OAuth2 flow to fetch a refresh token. Returns the refresh token.)r r �redirect_uriz�Attempting to launch a browser with the OAuth2 approval dialog at URL: %s [Note: due to a Python bug, you may see a spurious error message "object is not callable [...] in [...] Popen.__del__" which can be ignored.] z6Please navigate your browser to the following URL: %s z�In your browser you should see a page that requests you to authorize access to Google Cloud Platform APIs and Services on your behalf. After you approve, an authorization code will be displayed. � T)�new� autoraisez]Launching browser appears to have failed; please navigate a browser to the following URL: %s � zEnter the authorization code: )�http)�oauth2client�client�OAuth2WebServerFlowr r# r r �OOB_REDIRECT_URI�step1_get_authorize_url�sys�stdout�write� webbrowserr4 �time�sleepr �step2_exchange�CreateHttpRequest� refresh_token)rZ �scopesZlaunch_browser�flowZapproval_url�code�credentialsrP rP rQ �OAuth2ApprovalFlow� s>