o
    í6Wjä  ã                   @   s<   d dl mZmZ d dl mZ d dlmZ G dd„ deƒZdS )é    )ÚWebApplicationClientÚInsecureTransportError)Úis_secure_transport)ÚAuthBasec                   @   s"   e Zd ZdZddd„Zdd„ ZdS )ÚOAuth2z:Adds proof of authorization (OAuth2 token) to the request.Nc                 C   s>   |pt ||d�| _|r| ¡ D ]\}}t| j||ƒ qdS dS )a·  Construct a new OAuth 2 authorization object.

        :param client_id: Client id obtained during registration
        :param client: :class:`oauthlib.oauth2.Client` to be used. Default is
                       WebApplicationClient which is useful for any
                       hosted application but not mobile or desktop.
        :param token: Token dictionary, must include access_token
                      and token_type.
        )ÚtokenN)r   Ú_clientÚitemsÚsetattr)ÚselfÚ	client_idÚclientr   ÚkÚv© r   úl/home/esfera/Documents/content_generation/venv/lib/python3.10/site-packages/requests_oauthlib/oauth2_auth.pyÚ__init__	   s   
þzOAuth2.__init__c                 C   s<   t |jƒstƒ ‚| jj|j|j|j|jd�\|_|_|_|S )a  Append an OAuth 2 token to the request.

        Note that currently HTTPS is required for all requests. There may be
        a token type that allows for plain HTTP in the future and then this
        should be updated to allow plain HTTP on a white list basis.
        )Úhttp_methodÚbodyÚheaders)r   Úurlr   r   Ú	add_tokenÚmethodr   r   )r   Úrr   r   r   Ú__call__   s   
ÿzOAuth2.__call__)NNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r      s    
r   N)Úoauthlib.oauth2r   r   r   Úrequests.authr   r   r   r   r   r   Ú<module>   s    