Ë
    ”ÂiÌ  ã                   óR   — d Z ddlmZ ddlmZ ddlmZ ddlmZ dd„Zd	„ Zd
„ Z	d„ Z
y)zÕauthlib.spec.rfc5849.parameters.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This module contains methods related to `section 3.5`_ of the OAuth 1.0a spec.

.. _`section 3.5`: https://tools.ietf.org/html/rfc5849#section-3.5
é    )Úextract_params)Ú
url_encode)Úurlparseé   )ÚescapeNc                 óÞ   — |xs i }dj                  | D ��cg c]0  \  }}|j                  d«      rt        |«      › dt        |«      › d�‘Œ2 c}}«      }|r	d|› d�|z   }d|› �|d<   |S c c}}w )	a  **Prepare the Authorization header.**
    Per `section 3.5.1`_ of the spec.

    Protocol parameters can be transmitted using the HTTP "Authorization"
    header field as defined by `RFC2617`_ with the auth-scheme name set to
    "OAuth" (case insensitive).

    For example::

        Authorization: OAuth realm="Photos",
            oauth_consumer_key="dpf43f3p2l4k3l03",
            oauth_signature_method="HMAC-SHA1",
            oauth_timestamp="137131200",
            oauth_nonce="wIjqoS",
            oauth_callback="http%3A%2F%2Fprinter.example.com%2Fready",
            oauth_signature="74KNZJeDHnMBp0EMJ9ZHt%2FXKycU%3D",
            oauth_version="1.0"

    .. _`section 3.5.1`: https://tools.ietf.org/html/rfc5849#section-3.5.1
    .. _`RFC2617`: https://tools.ietf.org/html/rfc2617
    z, Úoauth_z="ú"zrealm="z", zOAuth ÚAuthorization)ÚjoinÚ
startswithr   )Úoauth_paramsÚheadersÚrealmÚkÚvÚheader_parameterss         úY/var/www/timesheet/venv/lib/python3.12/site-packages/authlib/oauth1/rfc5849/parameters.pyÚprepare_headersr      s”   € ð, Šm˜€Gð Ÿ	™	ð %÷	
á��1Ø�|‰|˜HÔ%ô �a‹yˆk˜œF 1›I˜; aÒ(ó	
óÐñ à% e W¨CÐ0Ð3DÑDÐð "(Ð(9Ð':Ð;€GˆOÑØ€Nùó#	
s   —5A)
c                 ód   — t        |«      }|j                  | «       |j                  d„ ¬«       |S )a>  Append OAuth params to an existing set of parameters.

    Both params and oauth_params is must be lists of 2-tuples.

    Per `section 3.5.2`_ and `3.5.3`_ of the spec.

    .. _`section 3.5.2`: https://tools.ietf.org/html/rfc5849#section-3.5.2
    .. _`3.5.3`: https://tools.ietf.org/html/rfc5849#section-3.5.3

    c                 ó*   — | d   j                  d«      S )Nr   r	   )r   )Úis    r   ú<lambda>z _append_params.<locals>.<lambda>O   s   € ˜a ™dŸo™o¨hÓ7€ ó    )Úkey)ÚlistÚextendÚsort)r   ÚparamsÚmergeds      r   Ú_append_paramsr!   >   s/   € ô �&‹\€FØ
‡M�M�,Ôð
 ‡K�KÑ7€KÔ8Ø€Mr   c                 ó,   — t        t        | |«      «      S )z—Prepare the Form-Encoded Body.

    Per `section 3.5.2`_ of the spec.

    .. _`section 3.5.2`: https://tools.ietf.org/html/rfc5849#section-3.5.2

    )r   r!   )r   Úbodys     r   Úprepare_form_encoded_bodyr$   S   s   € ô ”n \°4Ó8Ó9Ð9r   c                 ó´   — t        j                   |«      \  }}}}}}t        t        | t        |«      xs g «      «      }t        j                  ||||||f«      S )z—Prepare the Request URI Query.

    Per `section 3.5.3`_ of the spec.

    .. _`section 3.5.3`: https://tools.ietf.org/html/rfc5849#section-3.5.3

    )r   r   r!   r   Ú
urlunparse)r   ÚuriÚschÚnetÚpathÚparÚqueryÚfras           r   Úprepare_request_uri_queryr.   _   sZ   € ô '/×&7Ñ&7¸Ó&<Ñ#€Cˆˆd�C˜ Ü”~ l´NÀ5Ó4IÒ4OÈRÓPÓQ€EÜ×Ñ  S¨$°°U¸CÐ@ÓAÐAr   )NN)Ú__doc__Úauthlib.common.urlsr   r   r   Úutilr   r   r!   r$   r.   © r   r   ú<module>r3      s.   ðñõ /Ý *Ý (å ó+ò\ò*	:óBr   