
    &g
                     T    d Z ddlmZ ddlmZ ddlmZ  G d dej                  ZdS )zGoogle API key support.
This module provides authentication using the `API key`_.
.. _API key:
    https://cloud.google.com/docs/authentication/api-keys/
    )_helpers)credentials)
exceptionsc                        e Zd ZdZ fdZed             Zed             Z ej	        e
j                  d             Zd	dZd Z xZS )
CredentialszeAPI key credentials.
    These credentials use API key to provide authorization to applications.
    c                     t          t          |                                            |st          j        d          || _        dS )z
        Args:
            token (str): API key string
        Raises:
            ValueError: If the provided API key is not a non-empty string.
        z(Token must be a non-empty API key stringN)superr   __init__r   InvalidValuetoken)selfr   	__class__s     E/var/www/api/venv/lib/python3.11/site-packages/google/auth/api_key.pyr
   zCredentials.__init__   sG     	k4  ))+++ 	V)*TUUU


    c                     dS )NF r   s    r   expiredzCredentials.expired+   s    ur   c                     dS )NTr   r   s    r   validzCredentials.valid/   s    tr   c                     d S Nr   )r   requests     r   refreshzCredentials.refresh3   s    r   Nc                     |p| j         |d<   dS )zApply the API key token to the x-goog-api-key header.
        Args:
            headers (Mapping): The HTTP request headers.
            token (Optional[str]): If specified, overrides the current access
                token.
        zx-goog-api-keyN)r   )r   headersr   s      r   applyzCredentials.apply7   s     %*$7TZ !!!r   c                 0    |                      |           dS )a  Performs credential-specific before request logic.
        Refreshes the credentials if necessary, then calls :meth:`apply` to
        apply the token to the x-goog-api-key header.
        Args:
            request (google.auth.transport.Request): The object used to make
                HTTP requests.
            method (str): The request's HTTP method or the RPC method being
                invoked.
            url (str): The request's URI or the RPC service's URI.
            headers (Mapping): The request's headers.
        N)r   )r   r   methodurlr   s        r   before_requestzCredentials.before_request@   s     	

7r   r   )__name__
__module____qualname____doc__r
   propertyr   r   r   copy_docstringr   r   r   r   r!   __classcell__)r   s   @r   r   r      s         
 
 
 
 
   X   X X[455  658 8 8 8      r   r   N)r%   google.authr   r   r   r   r   r   r   <module>r*      s~     !           # # # # # # " " " " " "2 2 2 2 2+) 2 2 2 2 2r   