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__/tools.cpython-38.pyc
U

O��gm#�@s�dZddlmZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lm
Z
d
ddgZd
ZdZdZdZdd�Ze�ZGdd�dej�ZGdd�dej�Ze�d�ddd��Zdd�ZdS)z�Command-line tools for authenticating via OAuth 2.0

Do the OAuth 2.0 Web Server dance for a command line application. Stores the
generated credentials in a common file that is used by other example apps in
the same directory.
�)�print_functionN)�BaseHTTPServer)�http_client)�input)�urllib)�_helpers)�client�	argparser�run_flow�message_if_missingz�WARNING: Please configure OAuth 2.0

To make this sample run you will need to populate the client_secrets.json file
found at:

   {file_path}

with information from the APIs Console <https://code.google.com/apis/console>.

a
Failed to start a local webserver listening on either port 8080
or port 8090. Please check your firewall settings and locally
running programs that may be blocking or using those ports.

Falling back to --noauth_local_webserver and continuing with
authorization.
z�
Your browser has been opened to visit:

    {address}

If your browser is on a different machine then exit and re-run this
application with the command-line parameter

  --noauth_local_webserver
z:
Go to the following link in your browser:

    {address}
cCs�zddl}Wntk
r"YdSX|jdd�}|jdddd�|jdd	dd
d�|jdd
dgtddd�|jdddddddgdd�|S)NrF)�add_helpz--auth_host_name�	localhostz)Hostname when running a local web server.)�default�helpz--noauth_local_webserver�
store_truezDo not run a local web server.)�actionrrz--auth_host_porti�i��*z!Port web server should listen on.)r�type�nargsrz--logging_level�ERROR�DEBUG�INFO�WARNING�CRITICALz Set the logging level of detail.)r�choicesr)�argparse�ImportError�ArgumentParser�add_argument�int)r�parser�r!�?/opt/cppython/lib/python3.8/site-packages/oauth2client/tools.py�_CreateArgumentParserMs.����r#c@seZdZdZiZdS)�ClientRedirectServerz�A server to handle OAuth 2.0 redirects back to localhost.

    Waits for a single request and parses the query parameters
    into query_params and then stops serving.
    N)�__name__�
__module__�__qualname__�__doc__�query_paramsr!r!r!r"r$fsr$c@s eZdZdZdd�Zdd�ZdS)�ClientRedirectHandlerz�A handler for OAuth 2.0 redirects back to localhost.

    Waits for a single request and parses the query parameters
    into the servers query_params and then stops serving.
    cCsj|�tj�|�dd�|��tj�|j�}t	�
|j�}||j_
|j�d�|j�d�|j�d�dS)z�Handle a GET request.

        Parses the query parameters and prints a message
        if the flow has completed. Note that we can't detect
        if an error occurred.
        zContent-typez	text/htmls7<html><head><title>Authentication Status</title></head>s3<body><p>The authentication flow has completed.</p>s</body></html>N)Z
send_responser�OKZsend_headerZend_headersr�parse�urlparse�pathrZparse_unique_urlencoded�query�serverr)�wfile�write)�self�partsr/r!r!r"�do_GETvs��zClientRedirectHandler.do_GETcGsdS)zADo not log messages to stdout while running as cmd. line program.Nr!)r3�format�argsr!r!r"�log_message�sz!ClientRedirectHandler.log_messageN)r%r&r'r(r5r8r!r!r!r"r*osr*�c
Cs�|dkrt��}t���tt|j��|js�d}d}|jD]<}|}zt	|j
|ft�}Wntj
k
rlYq:Xd}qxq:||_|s�tt�|js�dj|j
|d�}ntj}||_|��}	|js�ddl}
|
j|	ddd�ttj|	d	��nttj|	d	��d}|j�sN|��d
|jk�r"t�d�d|jk�r:|jd}ntd
�t�d�ntd���}z|j||d�}Wn6tj k
�r�}
zt�d�|
��W5d}
~
XYnX|�!|�|�"|�td�|S)a�Core code for a command-line application.

    The ``run()`` function is called from your application and runs
    through all the steps to obtain credentials. It takes a ``Flow``
    argument and attempts to open an authorization server page in the
    user's default web browser. The server asks the user to grant your
    application access to the user's data. If the user grants access,
    the ``run()`` function returns new credentials. The new credentials
    are also stored in the ``storage`` argument, which updates the file
    associated with the ``Storage`` object.

    It presumes it is run from a command-line application and supports the
    following flags:

        ``--auth_host_name`` (string, default: ``localhost``)
           Host name to use when running a local web server to handle
           redirects during OAuth authorization.

        ``--auth_host_port`` (integer, default: ``[8080, 8090]``)
           Port to use when running a local web server to handle redirects
           during OAuth authorization. Repeat this option to specify a list
           of values.

        ``--[no]auth_local_webserver`` (boolean, default: ``True``)
           Run a local web server to handle redirects during OAuth
           authorization.

    The tools module defines an ``ArgumentParser`` the already contains the
    flag definitions that ``run()`` requires. You can pass that
    ``ArgumentParser`` to your ``ArgumentParser`` constructor::

        parser = argparse.ArgumentParser(
            description=__doc__,
            formatter_class=argparse.RawDescriptionHelpFormatter,
            parents=[tools.argparser])
        flags = parser.parse_args(argv)

    Args:
        flow: Flow, an OAuth 2.0 Flow to step through.
        storage: Storage, a ``Storage`` to store the credential in.
        flags: ``argparse.Namespace``, (Optional) The command-line flags. This
               is the object returned from calling ``parse_args()`` on
               ``argparse.ArgumentParser`` as described above. Defaults
               to ``argparser.parse_args()``.
        http: An instance of ``httplib2.Http.request`` or something that
              acts like it.

    Returns:
        Credentials, the obtained credential.
    NFrTzhttp://{host}:{port}/)�host�port�)�newZ	autoraise)�address�errorz$Authentication request was rejected.�codez>Failed to find "code" in the query parameters of the redirect.z*Try running with --noauth_local_webserver.zEnter verification code: )�httpzAuthentication has failed: {0}zAuthentication successful.)#r	�
parse_args�logging�	getLogger�setLevel�getattrZ
logging_levelZnoauth_local_webserverZauth_host_portr$Zauth_host_namer*�socketr?�print�_FAILED_START_MESSAGEr6rZOOB_CALLBACK_URNZredirect_uriZstep1_get_authorize_url�
webbrowser�open�_BROWSER_OPENED_MESSAGE�_GO_TO_LINK_MESSAGE�handle_requestr)�sys�exitr�stripZstep2_exchangeZFlowExchangeError�putZ	set_store)ZflowZstorage�flagsrA�successZport_numberr;ZhttpdZoauth_callbackZ
authorize_urlrJr@Z
credential�er!r!r"r
�sd4

��
"

cCstj|d�S)zAHelpful message to display if the CLIENT_SECRETS file is missing.)�	file_path)�_CLIENT_SECRETS_MESSAGEr6)�filenamer!r!r"r�s)NN)r(�
__future__rrCrGrOZ	six.movesrrrrZoauth2clientrr�__all__rWrIrLrMr#r	Z
HTTPServerr$ZBaseHTTPRequestHandlerr*�
positionalr
rr!r!r!r"�<module>s,
		p

F1le Man4ger