&``dZddlZddlZddlmZmZddlmZdZdZ dZ dZ d Z d Z d ZdS) zp oauthlib.utils ~~~~~~~~~~~~~~ This module contains utility methods used by various parts of the OAuth 2 spec. N)quoteurlparse) urldecodect|ts||St|tttfrdd|DSt d|z)z5Convert a list of scopes to a space separated string.N c,g|]}t|Sstr.0ss ?/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/utils.py z!list_to_scope..s///AQ///z8Invalid scope (%s), must be string, tuple, set, or list.) isinstancer settuplelistjoin ValueErrorscopes r list_to_scopersn%] EC- . .]xx/////000SV[[\\\rct|tttfr d|DS|dS|dS)z5Convert a space separated string to a list of scopes.c,g|]}t|Sr r r s rrz!scope_to_list..s&&&1A&&&rNr)rrrrstripsplitrs r scope_to_listrsU%%s+,,(&&&&&& t{{}}""3'''rcttt|j}d|vrt |d|d<|S)Nr)dictrrqueryr)uriparamss rparams_from_urir%"sE )HSMM/00 1 1F&'w88w Mrcddd}t|\}}}}}}d|vr|dd\}}n'||}||fS)zuExtract hostname and port from URI. Will use default port for HTTP and HTTPS if none is present in the URI. 80443)HTTPHTTPS:)rrgetupper) r# default_portsschnetlocpathparr"fraports r host_from_urir6)sw M *2#&CsE3 f}}||C++   -- 4<rct|tstdt|ddS)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)rr rrencode)us rescaper<<sE a  @>??? '"" . . ..rctj|z }|j|j|jdzdzzdzzdz }t |S)z9Generate a age parameter for MAC authentication draft 00.ii@B)datetimenow microsecondssecondsdaysr ) issue_timetdages r generate_agerGGsV     : -B ?bj27R<$+>>   C s88OrctjdrdS|dS)zCheck if the uri is over ssl.OAUTHLIB_INSECURE_TRANSPORTTzhttps://)osenvironr-lower startswith)r#s ris_secure_transportrNOs: z~~344t 99;; ! !* - --r)__doc__r?rJ urllib.parserroauthlib.commonrrrr%r6r<rGrNr rrrRs  ((((((((%%%%%%]]](((&///.....r