o
    ~j6h
  ã                   @   s>   d Z ddlmZ ddlmZ ddlmZ G dd„ dejƒZdS )zšGoogle API key support.
This module provides authentication using the `API key`_.
.. _API key:
    https://cloud.google.com/docs/authentication/api-keys/
é    )Ú_helpers)Úcredentials)Ú
exceptionsc                       s^   e Zd ZdZ‡ fdd„Zedd„ ƒZedd„ ƒZe 	e
j¡dd	„ ƒZddd„Zdd„ Z‡  ZS )ÚCredentialszeAPI key credentials.
    These credentials use API key to provide authorization to applications.
    c                    s&   t t| ƒ ¡  |st 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__© úb/var/www/html/chefvision.cloud.itp360.com/venv/lib/python3.10/site-packages/google/auth/api_key.pyr      s   

zCredentials.__init__c                 C   ó   dS )NFr   ©r
   r   r   r   Úexpired+   ó   zCredentials.expiredc                 C   r   )NTr   r   r   r   r   Úvalid/   r   zCredentials.validc                 C   s   d S ©Nr   )r
   Úrequestr   r   r   Úrefresh3   r   zCredentials.refreshNc                 C   s   |p| j |d< dS )zêApply 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	   r   r   r   Úapply7   s   zCredentials.applyc                 C   s   |   |¡ 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   r   r   r   Úbefore_request@   s   zCredentials.before_requestr   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr   r   r   Úcopy_docstringr   r   r   r   r   Ú__classcell__r   r   r   r   r      s    




	r   N)r   Úgoogle.authr   r   r   r   r   r   r   r   Ú<module>   s
   