
    qh5
                     R    S r SSKJr  SSKJrJr  SrS rS r	S r
S rS	 rS
 rS rg)zn
oauthlib.utils
~~~~~~~~~~~~~~

This module contains utility methods used by various parts of the OAuth
spec.
    N)quoteunquote>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789c                 6   ^  U 4S jnT R                   Ul         U$ )zDecorator which filters params to remove non-oauth_* parameters

Assumes the decorated method takes a params dict or list of tuples as its
first argument.
c                 2   > [        U 5      n T" U /UQ70 UD6$ )N)filter_oauth_params)paramsargskwargstargets      O/var/www/html/env/lib/python3.13/site-packages/oauthlib/oauth1/rfc5849/utils.pywrapperfilter_params.<locals>.wrapper   s"    $V,f.t.v..    )__doc__)r   r   s   ` r   filter_paramsr      s    / nnGONr   c           	          S n[        U [        5      (       a,  [        [        U[        U R	                  5       5      5      5      $ [        [        X5      5      $ )zARemoves all non oauth parameters from a dict or a list of params.c                 *    U S   R                  S5      $ )Nr   oauth_)
startswith)kvs    r   <lambda>%filter_oauth_params.<locals>.<lambda>!   s    "Q%**84r   )
isinstancedictlistfilteritems)r	   is_oauths     r   r   r      sA    4H&$F8T&,,.%9:;;F8,--r   c           	          [        U [        5      (       d'  [        SSR                  U [	        U 5      5      -   5      e[        U SS9$ )zEscape a unicode string in an OAuth-compatible fashion.

Per `section 3.6`_ of the spec.

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

z$Only unicode objects are escapable. zGot {!r} of type {}.   ~)safe)r   str
ValueErrorformattyper   us    r   escaper)   (   sL     a?/66q$q'BC D 	D r   c                 X    [        U [        5      (       d  [        S5      e[        U 5      $ )Nz%Only unicode objects are unescapable.)r   r#   r$   r   r'   s    r   unescaper+   8   s%    a@AA1:r   c                 .    [         R                  " U 5      $ )z1A unicode-safe version of urllib2.parse_keqv_list)urllib2parse_keqv_list)ls    r   r.   r.   >        ""1%%r   c                 .    [         R                  " U 5      $ )z1A unicode-safe version of urllib2.parse_http_list)r-   parse_http_listr'   s    r   r2   r2   D   r0   r   c                 8   SR                  5       nU S[        U5       R                  5       R                  U5      (       a:  [        U [        U5      S 5      n [	        [        U5      R                  5       5      $ [        S5      e! [        [        4 a     Nf = f)z;Parse an OAuth authorization header into a list of 2-tupleszOAuth NzMalformed authorization header)	lowerlenr   r2   r   r.   r   
IndexErrorr$   )authorization_headerauth_schemer   s      r   parse_authorization_headerr9   J   s    .."K-S-.446AA+NN 4S5E5F GH	.44677 5
66 J' 		s   !B BB)r   urllib.requestrequestr-   oauthlib.commonr   r   UNICODE_ASCII_CHARACTER_SETr   r   r)   r+   r.   r2   r9    r   r   <module>r?      s=    ! * , 
. &&	7r   