§
    'ê[f’  ã                   óÀ   — d dl mZ d dlmZ d dlmZ d dlmZmZ ddl	m
Z
mZmZmZ ddlmZ d	d
gZ G d„ d
ee¦  «        Z G d„ dee¦  «        Z G d„ d	ee¦  «        ZdS )é    )ÚSession)ÚAuthBase)ÚOAuth2Client)Ú
ClientAuthÚ	TokenAuthé   )Ú
OAuthErrorÚInvalidTokenErrorÚMissingTokenErrorÚUnsupportedTokenTypeErroré   )Úupdate_session_configureÚOAuth2SessionÚ
OAuth2Authc                   ó   — e Zd ZdZd„ Zd„ ZdS )r   zFSign requests for OAuth 2.0, currently only bearer token is supported.c                 ór   — | j         r-| j                              | j        ¦  «        st          ¦   «         ‚d S d S ©N)ÚclientÚensure_active_tokenÚtokenr
   )Úselfs    úg/var/www/piapp/venv/lib/python3.11/site-packages/authlib/integrations/requests_client/oauth2_session.pyr   zOAuth2Auth.ensure_active_token   sE   € ØŒ;ð 	&˜tœ{×>Ò>¸t¼zÑJÔJð 	&Ý#Ñ%Ô%Ð%ð	&ð 	&ð 	&ð 	&ó    c                 ó  — |                       ¦   «          	 |                      |j        |j        |j        ¦  «        \  |_        |_        |_        n4# t
          $ r'}dt          |¦  «        › �}t          |¬¦  «        ‚d }~ww xY w|S )NzUnsupported token_type: )Údescription)r   ÚprepareÚurlÚheadersÚbodyÚKeyErrorÚstrr   )r   ÚreqÚerrorr   s       r   Ú__call__zOAuth2Auth.__call__   s—   € Ø× Ò Ñ"Ô"Ð"ð	EØ-1¯\ª\Ø”˜œ c¤hñ.0ô .0Ñ*ˆCŒG�S”[ #¤( (øåð 	Eð 	Eð 	EØAµS¸±Z´ZÐAÐAˆKÝ+¸ÐDÑDÔDÐDøøøøð	Eøøøð ˆ
s   –9A Á
BÁ"A<Á<BN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r$   © r   r   r   r      s8   € € € € € ØPÐPð&ð &ð &ðð ð ð ð r   c                   ó   — e Zd ZdZd„ ZdS )ÚOAuth2ClientAuthzFAttaches OAuth Client Authentication to the given Request object.
    c                 ó„   — |                       |j        |j        |j        |j        ¦  «        \  |_        |_        |_        |S r   )r   Úmethodr   r   r   )r   r"   s     r   r$   zOAuth2ClientAuth.__call__%   s:   € Ø)-¯ªØŒJ˜œ ¤¨c¬hñ*
ô *
Ñ&ˆŒ�”˜cœhð ˆ
r   N)r%   r&   r'   r(   r$   r)   r   r   r+   r+   "   s-   € € € € € ðð ðð ð ð ð r   r+   c                   óP   ‡ — e Zd ZdZeZeZeZ	dZ
	 	 	 	 	 	 d	d„Zd
d„Zdˆ fd„	Zˆ xZS )r   a  Construct a new OAuth 2 client requests session.

    :param client_id: Client ID, which you get from client registration.
    :param client_secret: Client Secret, which you get from registration.
    :param authorization_endpoint: URL of the authorization server's
        authorization endpoint.
    :param token_endpoint: URL of the authorization server's token endpoint.
    :param token_endpoint_auth_method: client authentication method for
        token endpoint.
    :param revocation_endpoint: URL of the authorization server's OAuth 2.0
        revocation endpoint.
    :param revocation_endpoint_auth_method: client authentication method for
        revocation endpoint.
    :param scope: Scope that you needed to access user resources.
    :param state: Shared secret to prevent CSRF attack.
    :param redirect_uri: Redirect URI you registered as callback.
    :param token: A dict of token attributes such as ``access_token``,
        ``token_type`` and ``expires_at``.
    :param token_placement: The place to put token in HTTP request. Available
        values: "header", "body", "uri".
    :param update_token: A function for you to update token. It accept a
        :class:`OAuth2Token` as parameter.
    :param default_timeout: If settled, every requests will have a default timeout.
    )
Úallow_redirectsÚtimeoutÚcookiesÚfilesÚproxiesÚhooksÚstreamÚverifyÚcertÚjsonNÚheaderc                 ó˜   — t          j        | ¦  «         || _        t          | |¦  «         t	          j        | f| |||||||||	|
dœ|¤Ž d S )N)ÚsessionÚ	client_idÚclient_secretÚtoken_endpoint_auth_methodÚrevocation_endpoint_auth_methodÚscopeÚstateÚredirect_urir   Útoken_placementÚupdate_token)r   Ú__init__Údefault_timeoutr   r   )r   r<   r=   r>   r?   r@   rA   rB   r   rC   rD   rF   Úkwargss                r   rE   zOAuth2Session.__init__M   s€   € õ 	Ô˜ÑÔÐØ.ˆÔÝ   vÑ.Ô.Ð.åÔØð	
ØØ¨}Ø'AØ,KØ˜u°<Ø¨Ø%ð	
ð 	
ð *0ð	
ð 	
ð 	
ð 	
ð 	
r   c                 ó   —  | j         |fi |¤ŽS )zAlias for fetch_token.)Úfetch_token)r   r   rG   s      r   Úfetch_access_tokenz OAuth2Session.fetch_access_tokena   s   € àˆtÔ Ð.Ð. vÐ.Ð.Ð.r   Fc                 óÂ   •— | j         r|                     d| j         ¦  «         |s|€| j        st          ¦   «         ‚| j        } t          ¦   «         j        ||fd|i|¤ŽS )z<Send request with auto refresh token feature (if available).r0   NÚauth)rF   Ú
setdefaultr   r   Ú
token_authÚsuperÚrequest)r   r-   r   Úwithhold_tokenrL   rG   Ú	__class__s         €r   rP   zOAuth2Session.requeste   s„   ø€ àÔð 	?Ø×Ò˜i¨Ô)=Ñ>Ô>Ð>Øð 	# $ ,Ø”:ð *Ý'Ñ)Ô)Ð)Ø”?ˆDØ�u‰wŒwŒØ�Cð.ð .Ø"ð.Ø&,ð.ð .ð 	.r   )NNNNNNNNr9   NNr   )FN)r%   r&   r'   r(   r+   Úclient_auth_classr   Útoken_auth_classr	   Úoauth_error_classÚSESSION_REQUEST_PARAMSrE   rJ   rP   Ú__classcell__)rR   s   @r   r   r   ,   sŸ   ø€ € € € € ðð ð0 )ÐØ!ÐØ"ÐðÐð
 6:Ø,0Ø15Ø6:Ø-5Ø48ð
ð 
ð 
ð 
ð(/ð /ð /ð /ð	.ð 	.ð 	.ð 	.ð 	.ð 	.ð 	.ð 	.ð 	.ð 	.r   N)Úrequestsr   Úrequests.authr   Úauthlib.oauth2.clientr   Úauthlib.oauth2.authr   r   Úbase_clientr	   r
   r   r   Úutilsr   Ú__all__r   r+   r   r)   r   r   ú<module>r_      sE  ðØ Ð Ð Ð Ð Ð Ø "Ð "Ð "Ð "Ð "Ð "Ø .Ð .Ð .Ð .Ð .Ð .Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5ðð ð ð ð ð ð ð ð ð ð ð ð ,Ð +Ð +Ð +Ð +Ð +à˜LÐ
)€ðð ð ð ð �˜9ñ ô ð ð$ð ð ð ð �x ñ ô ð ðB.ð B.ð B.ð B.ð B.�L 'ñ B.ô B.ð B.ð B.ð B.r   