|
Server : Apache System : Linux server.mata-lashes.com 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 User : matalashes ( 1004) PHP Version : 8.1.29 Disable Function : NONE Directory : /proc/17567/root/usr/local/lib/python3.6/site-packages/oauthlib/__pycache__/ |
Upload File : |
3
F�KdA4 � @ s� d Z ddlZddlZddlZddlZddlZddljZddlm Z
mZm
Z ddlmZ yddlmZmZ W n$ ek
r� ddlmZmZ Y nX dZd Zejd
ej�Zejd�ZdZejd
�Zd9dd�Z dd� Zdd� Z
dd� Z dd� Z!e"e�e"d�B Z#dd� Z$dd� Z%dd� Z&d d!� Z'd"efd#d$�Z(d%d&� Z)d'd(� Z*d"efd)d*�Z+d+d,� Z,d:d.d/�Z-d0d1� Z.d;d3d4�Z/G d5d6� d6e0�Z1G d7d8� d8�Z2dS )<z|
oauthlib.common
~~~~~~~~~~~~~~
This module provides data structures and utilities common
to all implementations of OAuth.
� N)�quote�unquote� urlencode� )� get_debug)�SystemRandom�randbits)r �getrandbitsZ>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789z_ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}z&([^&;]*(?:password|token)[^=]*=)[^&;]+z&%[^0-9A-Fa-f]|%[0-9A-Fa-f][^0-9A-Fa-f]zAABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-Zoauthlib� /c C s: t | t�r| jd�n| } t| |�} t | t�r6| jd�} | S )Nzutf-8)�
isinstance�str�encode�_quote�bytes�decode)�s�safe� r �3/tmp/pip-build-8nxjc3nm/oauthlib/oauthlib/common.pyr + s
r c C s t | �} t| t�r| jd�} | S )Nzutf-8)�_unquoter r r )r r r r r 5 s
r c C s, t | �}t|�}t|t�r|S |jd�S d S )Nzutf-8)�encode_params_utf8�
_urlencoder r r )�paramsZutf8_params�
urlencodedr r r r ? s
r c C sP g }xF| D ]>\}}|j t|t�r*|jd�n|t|t�r@|jd�n|f� q
W |S )ziEnsures that all parameters in a list of 2-element tuples are encoded to
bytestrings using UTF-8
zutf-8)�appendr r r
)r �encoded�k�vr r r r H s r c C sP g }xF| D ]>\}}|j t|t�r*|jd�n|t|t�r@|jd�n|f� q
W |S )zfEnsures that all parameters in a list of 2-element tuples are decoded to
unicode using UTF-8.
zutf-8)r r r r )r �decodedr r r r r �decode_params_utf8T s r z=&;:%+~,*@!()/?'$c C sV | r.t | �tk r.d}t|t | �t | f ��tj| �r@td��tj| dd�}t|�S )a� Decode a query string in x-www-form-urlencoded format into a sequence
of two-element tuples.
Unlike urlparse.parse_qsl(..., strict_parsing=True) urldecode will enforce
correct formatting of the query string by validation. If validation fails
a ValueError will be raised. urllib.parse_qsl will only raise errors if
any of name-value pairs omits the equals sign.
z�Error trying to decode a non urlencoded string. Found invalid characters: %s in the string: '%s'. Please ensure the request/response body is x-www-form-urlencoded.z%Invalid hex encoding in query string.T)�keep_blank_values)�setr �
ValueError�INVALID_HEX_PATTERN�search�urlparse� parse_qslr )�query�errorr r r r � urldecodec s
r) c C s� t | ttf�r6yt| �}W q� tk
r2 d}Y q�X nnt| d�r�yt| � W n. tk
rd d}Y q� tk
rz d}Y q�X tt | t�r�| j � n| �}t
|�}nd}|S )a* Extract parameters and return them as a list of 2-tuples.
Will successfully extract parameters from urlencoded query strings,
dicts, or lists of 2-tuples. Empty strings/dicts/lists will return an
empty list of parameters. Any other input will result in a return
value of None.
N�__iter__)r r r r) r"