name : utils.cpython-39.pyc
a

\��`��@sldZddlZddlZddlmZmZddlmZdd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�ZdS)zp
oauthlib.utils
~~~~~~~~~~~~~~

This module contains utility methods used by various parts of the OAuth 2 spec.
�N)�quote�urlparse)�	urldecodecCsJt|t�s|dur|St|tttf�r:d�dd�|D��Std|��dS)z5Convert a list of scopes to a space separated string.N� cSsg|]}t|��qS���str��.0�srr�A/usr/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/utils.py�
<listcomp>�z!list_to_scope.<locals>.<listcomp>z8Invalid scope (%s), must be string, tuple, set, or list.)�
isinstancer�set�tuple�list�join�
ValueError��scoperrr�
list_to_scopes
rcCs<t|tttf�rdd�|D�S|dur*dS|���d�SdS)z5Convert a space separated string to a list of scopes.cSsg|]}t|��qSrrr	rrrr
rz!scope_to_list.<locals>.<listcomp>Nr)rrrr�strip�splitrrrr�
scope_to_lists
rcCs.ttt|�j��}d|vr*t|d�|d<|S)Nr)�dictrr�queryr)�uri�paramsrrr�params_from_uri"src	CsNddd�}t|�\}}}}}}d|vr8|�dd�\}}n|�|���}||fS)zuExtract hostname and port from URI.

    Will use default port for HTTP and HTTPS if none is present in the URI.
    Z80Z443)ZHTTPZHTTPS�:�)rr�get�upper)	rZ
default_portsZsch�netloc�pathZparrZfra�portrrr�
host_from_uri)s�r'cCs$t|t�std��t|�d�dd�S)ztEscape a string in an OAuth-compatible fashion.

    TODO: verify whether this can in fact be used for OAuth 2

    z#Only unicode objects are escapable.zutf-8�~)�safe)rrrr�encode)�urrr�escape<s
r,cCs8tj��|}|j|j|jdddd}t|�S)z9Generate a age parameter for MAC authentication draft 00.�ii@B)�datetimeZnowZmicrosecondsZsecondsZdaysr)Z
issue_timeZtdZagerrr�generate_ageGs��r/cCstj�d�rdS|���d�S)zCheck if the uri is over ssl.ZOAUTHLIB_INSECURE_TRANSPORTTzhttps://)�os�environr"�lower�
startswith)rrrr�is_secure_transportOsr4)�__doc__r.r0�urllib.parserrZoauthlib.commonrrrrr'r,r/r4rrrr�<module>s



© 2025 Cubjrnet7