o
    ÿÑÐb^  ã                   @   s€   d dl mZ d dlmZ d dlmZmZ d dlmZ d dlm	Z	 d dl
mZ ddlmZ G d	d
„ d
ee	ƒZG dd„ deeƒZdS )é    )ÚSession)ÚAuthBase)ÚSIGNATURE_HMAC_SHA1ÚSIGNATURE_TYPE_HEADER)Ú	to_native)Ú
ClientAuth)ÚOAuth1Clienté   ©Ú
OAuthErrorc                   @   s   e Zd ZdZdd„ ZdS )Ú
OAuth1Authz)Signs the request using OAuth 1 (RFC5849)c                 C   s@   |   |j|j|j|j¡\}}}t|ƒ|_| |¡ |r||_|S ©N)ÚprepareÚmethodÚurlÚheadersÚbodyr   Úprepare_headers)ÚselfÚreqr   r   r   © r   úr/var/www/secure340b-portal/env/lib/python3.10/site-packages/authlib/integrations/requests_client/oauth1_session.pyÚ__call__   s   
ÿ

zOAuth1Auth.__call__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r      s    r   c                	   @   s@   e Zd ZeZddddddeedf	dd„Zdd„ Ze	dd„ ƒZ
dS )	ÚOAuth1SessionNFc                 K   s8   t  | ¡ tj| f| |||||||||	|
dœ|¤Ž d S )N)ÚsessionÚ	client_idÚclient_secretÚtokenÚtoken_secretÚredirect_uriÚrsa_keyÚverifierÚsignature_methodÚsignature_typeÚforce_include_body)r   Ú__init__r   )r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   Úkwargsr   r   r   r)      s   
ÿú
úzOAuth1Session.__init__c                 C   s,   d|j v r|j  dd¡ | | j¡ dS dS )z„When being redirected we should always strip Authorization
        header, since nonce may not be reused as per OAuth spec.
        ÚAuthorizationTN)r   ÚpopÚprepare_authÚauth)r   Úprepared_requestÚresponser   r   r   Úrebuild_auth.   s   
üzOAuth1Session.rebuild_authc                 C   s
   t | |ƒ‚r   r
   )Z
error_typeZerror_descriptionr   r   r   Úhandle_error8   s   
zOAuth1Session.handle_error)r   r   r   r   Z
auth_classr   r   r)   r1   Ústaticmethodr2   r   r   r   r   r      s    
û
r   N)Úrequestsr   Zrequests.authr   Zauthlib.oauth1r   r   Zauthlib.common.encodingr   r   Zauthlib.oauth1.clientr   Zbase_clientr   r   r   r   r   r   r   Ú<module>   s   