
    ([f                     D    d Z ddlmZmZmZ ddlmZ d
dZd Zd Z	d	 Z
dS )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
    )urlparse
url_encodeextract_params   )escapeNc                 r    |pi }d                     d | D                       }|r	d| d|z   }d| |d<   |S )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, c                     g | ]<\  }}|                     d           t          |           dt          |           d=S )oauth_z="")
startswithr   ).0kvs      U/var/www/piapp/venv/lib/python3.11/site-packages/authlib/oauth1/rfc5849/parameters.py
<listcomp>z#prepare_headers.<locals>.<listcomp>&   s[     # # #)-A<<!!#!99$$q		$$$# # #    zrealm="z", zOAuth Authorization)join)oauth_paramsheadersrealmheader_parameterss       r   prepare_headersr      s{    , mG 		 # #1=# # #    E0e0003DD  <(9;;GONr   c                 |    t          |          }|                    |            |                    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                 8    | d                              d          S )Nr   r
   )r   )is    r   <lambda>z _append_params.<locals>.<lambda>I   s    adooh77 r   )key)listextendsort)r   paramsmergeds      r   _append_paramsr$   8   s@     &\\F
MM,
 KK77K888Mr   c                 <    t          t          | |                    S )zPrepare 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'   M   s     n\488999r   c                     t          j         |          \  }}}}}}t          t          | t          |          pg                     }t          j        ||||||f          S )zPrepare 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_queryr1   Y   sj     '/&7&<&<#CdC|^E%:%:%@bAAC CES$UC@AAAr   )NN)__doc__authlib.common.urlsr   r   r   utilr   r   r$   r'   r1    r   r   <module>r6      s     E D D D D D D D D D      ( ( ( (V  *	: 	: 	:B B B B Br   