
    g                         d dl Z d dlmZ d dlmZmZmZ d dlmZ d dlm	Z	 d dl
mZ dZdZ e j                  e      Z G d	 d
e      Zy)    N)extract_params)ClientSIGNATURE_HMACSIGNATURE_TYPE_AUTH_HEADER)SIGNATURE_TYPE_BODY)to_native_string)AuthBasez!application/x-www-form-urlencodedzmultipart/form-datac                   8    e Zd ZdZeZddddeedddddfdZd Z	y)OAuth1z)Signs the request using OAuth 1 (RFC5849)Nutf-8Fc                     	 |j                         }|xs | j                  }|| _         ||||||||||	f	d|
i|| _        y # t        $ r Y ;w xY w)Ndecoding)upperAttributeErrorclient_classforce_include_bodyclient)self
client_keyclient_secretresource_owner_keyresource_owner_secretcallback_urisignature_methodsignature_typersa_keyverifierr   r   r   kwargss                 R/var/www/openai/venv/lib/python3.12/site-packages/requests_oauthlib/oauth1_auth.py__init__zOAuth1.__init__   s~    "	+113N $8t'8'8"4"!
 
 
  		s   A 	AAc                 ,   t         j                  d|| j                         |j                  j	                  dd      }|st        |j                        s| j                  j                  t        k(  rt        }t        |t              s|j                  d      }t        |v }t         j                  d|xs | j                         |r~t        |j                  d<   | j                  j                  t        |j                        t        |j                         |j                  xs d|j                        \  |_        }|_        n| j                  rk| j                  j                  t        |j                        t        |j                         |j                  xs d|j                        \  |_        }|_        nW| j                  j                  t        |j                        t        |j                         d|j                        \  |_        }}|j#                  |       t%        |j                        |_        t         j                  d|j                         t         j                  d|       t         j                  d	|j                         |S )
zAdd OAuth parameters to the request.

        Parameters may be included from the body if the content-type is
        urlencoded, if no content type is set a guess is made.
        z"Signing request %s using client %szContent-Type r   z"Including body in call to sign: %sNzUpdated url: %szUpdated headers: %szUpdated body: %r)logdebugr   headersgetr   bodyr   r   CONTENT_TYPE_FORM_URLENCODED
isinstancestrdecoder   signurlmethodprepare_headersr   )r   rcontent_typeis_form_encodedr%   _s         r   __call__zOAuth1.__call__@   s    			64;;Gyy}}^R8qvv&{{))-@@7L,,'..w7L6,F		06t66	

 (DAIIn%%)[[%5%5AEE
CM166<R&"AE7AF $$%)[[%5%5AEE
CM166<R&"AE7AF
 !% 0 0AEE
CM4!AE7A 	
'" '		#QUU+		'1		$aff-    )
__name__
__module____qualname____doc__r   r   r   r   r    r4    r5   r   r   r      s8    3L
 "'1 &
P0r5   r   )loggingoauthlib.commonr   oauthlib.oauth1r   r   r   r   requests.utilsr   requests.authr	   r(   CONTENT_TYPE_MULTI_PART	getLoggerr6   r#   r   r:   r5   r   <module>rB      sH     * N N / + "B /  g!
]X ]r5   