관리-도구
편집 파일: utils.cpython-39.pyc
a ����\��`�����������������������@���sl���d�Z�ddlZddlZddlmZmZ�ddlmZ�dd��Zdd��Z d d ��Z dd��Zd d��Zdd��Z dd��ZdS�)zp oauthlib.utils ~~~~~~~~~~~~~~ This module contains utility methods used by various parts of the OAuth 2 spec. �����N)�quote�urlparse)� urldecodec�����������������C���sJ���t�|�t�s|�du�r|�S�t�|�tttf�r:d�dd��|�D���S�td|����dS�)z5Convert a list of scopes to a space separated string.N� c�����������������S���s���g�|�]}t�|��qS�����str��.0�sr���r����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��scoper���r���r���� list_to_scope���s ����r���c�����������������C���s<���t�|�tttf�rdd��|�D��S�|�du�r*dS�|�����d�S�dS�)z5Convert a space separated string to a list of scopes.c�����������������S���s���g�|�]}t�|��qS�r���r���r ���r���r���r���r ������r���z!scope_to_list.<locals>.<listcomp>Nr���)r���r���r���r����strip�splitr���r���r���r���� scope_to_list���s ����r���c�����������������C���s.���t�tt|��j��}d|v�r*t|d��|d<�|S�)Nr���)�dictr���r����queryr���)�uri�paramsr���r���r����params_from_uri"���s����r���c����������� ������C���sN���ddd�}t�|��\}}}}}}d|v�r8|�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�:����)r���r����get�upper) r���Z default_portsZsch�netloc�pathZparr���Zfra�portr���r���r���� host_from_uri)���s�����r'���c�����������������C���s$���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)r���r���r���r����encode)�ur���r���r����escape<���s���� r,���c�����������������C���s8���t�j����|��}|j|j|jd�d��d��d�}t|�S�)z9Generate a age parameter for MAC authentication draft 00.����i��i@B�)�datetimeZnowZmicrosecondsZsecondsZdaysr���)Z issue_timeZtdZager���r���r����generate_ageG���s������r/���c�����������������C���s���t�j�d�rdS�|�����d�S�)zCheck if the uri is over ssl.ZOAUTHLIB_INSECURE_TRANSPORTTzhttps://)�os�environr"����lower� startswith)r���r���r���r����is_secure_transportO���s����r4���)�__doc__r.���r0����urllib.parser���r���Zoauthlib.commonr���r���r���r���r'���r,���r/���r4���r���r���r���r����<module>���s���