
                             S r SSKJrJr  SSKJrJr  SSKJr   SSK	J	r	J
r
  \R                  SS j5       rS	 rS
 rS rg! \ a    SSKJ	r	J
r
   N.f = f)zoauthlib.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
    )absolute_importunicode_literals)extract_params	urlencode   )utils)urlparse
urlunparseNc                 J   U=(       d    0 n/ nU  HS  u  pE[         R                  " U5      n[         R                  " U5      nSR                  Xg5      nUR                  U5        MU     SR	                  U5      n	U(       a  SU-  U	-   n	SU	-  n
0 nUR                  U5        XS'   U$ )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="Example",
        oauth_consumer_key="0685bd9184jfhq22",
        oauth_token="ad180jjd733klru7",
        oauth_signature_method="HMAC-SHA1",
        oauth_signature="wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D",
        oauth_timestamp="137131200",
        oauth_nonce="4572616e48616d6d65724c61686176",
        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	{0}="{1}"z, zrealm="%s", zOAuth %sAuthorization)r   escapeformatappendjoinupdate)oauth_paramsheadersrealm%authorization_header_parameters_partsoauth_parameter_namevalueescaped_nameescaped_valuepartauthorization_header_parametersauthorization_headerfull_headerss               5lib/third_party/oauthlib/oauth1/rfc5849/parameters.pyprepare_headersr      s    2 Mr' +-'%1!
 << 45LLL'M
 l:D)006 &2& %)II+%-! '5'='F(G# $&EE ,g"6	    c                 ^    [        U5      nUR                  U 5        UR                  S S9  U$ )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                 *    U S   R                  S5      $ )Nr   oauth_)
startswith)is    r   <lambda> _append_params.<locals>.<lambda>n   s    AaDOOH5r    )key)listextendsort)r   paramsmergeds      r   _append_paramsr.   ]   s/     <&--
 	++5+6	-r    c                     [        X5      $ )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   bodys     r   prepare_form_encoded_bodyr1   r   s     
	++r    c                     [        U5      u  p#pEpg[        [        U [        U5      =(       d    / 5      5      n[	        X#XEXg45      $ )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   r
   )r   urischnetpathparqueryfras           r   prepare_request_uri_queryr:   ~   sA     %-SM!#Du
N<1F1L"M
N%	St%5	66r    )NN)__doc__
__future__r   r   oauthlib.commonr   r    r   r	   r
   ImportErrorurllib.parsefilter_paramsr   r.   r1   r:    r    r   <module>rC      sa    9 5 0+ C CL*	,7]  0//0s   A   AA