
    h                         d Z ddlZddlZdZdZeg dddgdeg dddgdiZ G d	 d
e          Z G d de          Zd Z	d Z
d Zd ZddZdS )zUtilities for reading OAuth 2.0 client secret files.

A client_secrets.json file contains all the information needed to interact with
an OAuth 2.0 protected service.
    Nweb	installed)	client_idclient_secretredirect_urisauth_uri	token_urir   r   )requiredstringc                       e Zd ZdZdS )ErrorzBase error for this module.N__name__
__module____qualname____doc__     r/home/visionen/pythonvenv/lib/python3.11/site-packages/oauth2client-4.1.3-py3.11.egg/oauth2client/clientsecrets.pyr   r   <   s        %%%%r   r   c                       e Zd ZdZdS )InvalidClientSecretsErrorz(Format of ClientSecrets file is invalid.Nr   r   r   r   r   r   @   s        2222r   r   c                 *   d}| t          |          	 |                                 \  \  }}n'# t          t          f$ r t          |dz             w xY w|t          vr"t          d                    |                    t          |         d         D ])}||vr#t          d                    ||                    *t          |         d         D ]?}||                             d          r"t          d	                    |                    @||fS )
zValidate parsed client secrets from a file.

    Args:
        clientsecrets_dict: dict, a dictionary holding the client secrets.

    Returns:
        tuple, a string of the client type and the information parsed
        from the file.
    ziInvalid file format. See https://developers.google.com/api-client-library/python/guide/aaa_client_secretsNzU Expected a JSON object with a single property for a "web" or "installed" applicationzUnknown client type: {0}.r
   z1Missing property "{0}" in a client type of "{1}".r   z[[z!Property "{0}" is not configured.)r   items
ValueErrorAttributeErrorVALID_CLIENTformat
startswith)clientsecrets_dict_INVALID_FILE_FORMAT_MSGclient_typeclient_info	prop_names        r   _validate_clientsecretsr$   D   sy   	* 
 !'(@AAA'&8&>&>&@&@#"kk' ' ' ''$ (& &' ' 	'' ,&&''..{;;= = 	= "+.z: - -	K''+CJJ{, ,- - - ( "+.x8 G G	y!,,T22 	G+3::9EEG G G	G ##s	   / $Ac                 H    t          j        |           }t          |          S N)jsonloadr$   )fpobjs     r   r(   r(   m   s    
)B--C"3'''r   c                 H    t          j        |           }t          |          S r&   )r'   loadsr$   )sr*   s     r   r,   r,   r   s    
*Q--C"3'''r   c                    	 t          | d          5 }t          j        |          }d d d            n# 1 swxY w Y   n3# t          $ r&}t	          d|j        |j        |j                  d }~ww xY wt          |          S )NrzError opening file)	openr'   r(   IOErrorr   filenamestrerrorerrnor$   )r2   r)   r*   excs       r   	_loadfiler6   w   s    A(C   	 B)B--C	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  A A A'(<cl(+ciA A 	AA #3'''s-   ? 3? 7? 7? 
A/	!A**A/c                     d}|st          |           S |                    | |          }|.t          |           \  }}||i}|                    | ||           t          t	          j        |                    S )a  Loading of client_secrets JSON file, optionally backed by a cache.

    Typical cache storage would be App Engine memcache service,
    but you can pass in any other cache client that implements
    these methods:

    * ``get(key, namespace=ns)``
    * ``set(key, value, namespace=ns)``

    Usage::

        # without caching
        client_type, client_info = loadfile('secrets.json')
        # using App Engine memcache service
        from google.appengine.api import memcache
        client_type, client_info = loadfile('secrets.json', cache=memcache)

    Args:
        filename: string, Path to a client_secrets.json file on a filesystem.
        cache: An optional cache service client that implements get() and set()
        methods. If not specified, the file is always being loaded from
                 a filesystem.

    Raises:
        InvalidClientSecretsError: In case of a validation error or some
                                   I/O failure. Can happen only on cache miss.

    Returns:
        (client_type, client_info) tuple, as _loadfile() normally would.
        JSON contents is validated only during first load. Cache hits are not
        validated.
    zoauth2client:secrets#ns)	namespace)r6   getsetnextsix	iteritems)r2   cache_SECRET_NAMESPACEr*   r!   r"   s         r   loadfiler@      s    B 2 #"""
))H(9)
:
:C
{#,X#6#6 [K(		(C+<	===c""###r   r&   )r   r'   r<   TYPE_WEBTYPE_INSTALLEDr   	Exceptionr   r   r$   r(   r,   r6   r@   r   r   r   <module>rD      s;     



  
 
 
 
  
 
 
 
 <& & & & &I & & &3 3 3 3 3 3 3 3&$ &$ &$R( ( (
( ( (
( ( (,$ ,$ ,$ ,$ ,$ ,$r   