HOME


Mini Shell 1.0
DIR: /lib/python3/dist-packages/oauthlib/oauth1/rfc5849/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/oauthlib/oauth1/rfc5849/__pycache__/utils.cpython-312.pyc
�

&�`5
��R�dZddlmZddlmZmZdZd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zy)zn
oauthlib.utils
~~~~~~~~~~~~~~

This module contains utility methods used by various parts of the OAuth
spec.
�N)�quote�unquote�>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789c�4���fd�}�j|_|S)z�Decorator 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��t|�}�|g|��i|��S)N)�filter_oauth_params)�params�args�kwargs�targets   ��?/usr/lib/python3/dist-packages/oauthlib/oauth1/rfc5849/utils.py�wrapperzfilter_params.<locals>.wrappers"���$�V�,���f�.�t�.�v�.�.�)�__doc__)rrs` r
�
filter_paramsrs���/��n�n�G�O��Nrc	��d�}t|t�r,tt|t|j	����Stt||��S)zARemoves all non oauth parameters from a dict or a list of params.c�*�|djd�S)Nr�oauth_)�
startswith)�kvs r
�<lambda>z%filter_oauth_params.<locals>.<lambda>!s��"�Q�%�*�*�8�4�r)�
isinstance�dict�list�filter�items)r	�is_oauths  r
rrs@��4�H��&�$���F�8�T�&�,�,�.�%9�:�;�;��F�8�V�,�-�-rc	��t|t�s'tddj|t	|��z��t|d��S)z�Escape 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. zGot {!r} of type {}.�~)�safe)r�str�
ValueError�format�typer��us r
�escaper'(sI���a����?�/�6�6�q�$�q�'�B�C�D�	D�����rc�N�t|t�std��t|�S)Nz%Only unicode objects are unescapable.)rr!r"rr%s r
�unescaper)8s"���a����@�A�A��1�:�rc�,�tj|�S)z1A unicode-safe version of urllib2.parse_keqv_list)�urllib2�parse_keqv_list)�ls r
r,r,>����"�"�1�%�%rc�,�tj|�S)z1A unicode-safe version of urllib2.parse_http_list)r+�parse_http_listr%s r
r0r0Dr.rc�@�dj�}|dt|�j�j|�r:t|t|�d�}	t	t|�j
��Std��#ttf$r
Ytd��wxYw)z;Parse an OAuth authorization header into a list of 2-tupleszOAuth NzMalformed authorization header)	�lower�lenrr0rr,r�
IndexErrorr")�authorization_header�auth_schemers   r
�parse_authorization_headerr7Js����.�.�"�K��-�S��-�.�4�4�6�A�A�+�N�� 4�S��5E�5F� G�H��	����.�4�4�6�7�7��5�
6�6���J�'�	��
�5�
6�6�	�s�!B�B�B)r�urllib.request�requestr+�oauthlib.commonrr�UNICODE_ASCII_CHARACTER_SETrrr'r)r,r0r7�rr
�<module>r=s=���!�*� ,��
�.�
� �&�&�	7r