
    qh                     ^    S r SSKrSSKrSSKJrJr  SSKJr  S rS r	S r
S rS	 rS
 rS rg)zp
oauthlib.utils
~~~~~~~~~~~~~~

This module contains utility methods used by various parts of the OAuth 2 spec.
    N)quoteurlparse)	urldecodec                     [        U [        5      (       d  U c  U $ [        U [        [        [        45      (       a+  SR                  U  Vs/ s H  n[        U5      PM     sn5      $ [        SU -  5      es  snf )z5Convert a list of scopes to a space separated string. z8Invalid scope (%s), must be string, tuple, set, or list.)
isinstancestrsettuplelistjoin
ValueErrorscopess     O/var/www/html/env/lib/python3.13/site-packages/oauthlib/oauth2/rfc6749/utils.pylist_to_scoper      se    %	EC-	.	.xx/AQ/00SV[[\\ 0s   
A4c                     [        U [        [        [        45      (       a  U  Vs/ s H  n[	        U5      PM     sn$ U c  gU R                  5       R                  S5      $ s  snf )z5Convert a space separated string to a list of scopes.Nr   )r   r   r   r
   r	   stripsplitr   s     r   scope_to_listr      sS    %%s+,, %&1A&&	{{}""3''	 's   A c                     [        [        [        U 5      R                  5      5      nSU;   a  [	        US   5      US'   U$ )Nr   )dictr   r   queryr   )uriparamss     r   params_from_urir   "   s:    )HSM//01F&'w8wM    c                     SSS.n[        U 5      u  p#pEpgSU;   a  UR                  SS5      u  p8X84$ UR                  UR                  5       5      nX84$ )zmExtract hostname and port from URI.

Will use default port for HTTP and HTTPS if none is present in the URI.
80443)HTTPHTTPS:   )r   r   getupper)	r   default_portsschnetlocpathparr   fraports	            r   host_from_urir/   )   sf     M
 *2#&CE
f}||C+ <   -<r   c                 t    [        U [        5      (       d  [        S5      e[        U R	                  S5      SS9$ )zlEscape 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.zutf-8   ~)safe)r   r	   r   r   encode)us    r   escaper5   <   s3     a>??'"..r   c                     [         R                   R                  5       U -
  nUR                  UR                  UR                  S-  S-  -   S-  -   S-  n[        U5      $ )z9Generate a age parameter for MAC authentication draft 00.   i  i@B )datetimenowmicrosecondssecondsdaysr	   )
issue_timetdages      r   generate_ager@   G   sZ    						 :	-B??bjj277R<$+>>  Cs8Or   c                     [         R                  R                  S5      (       a  gU R                  5       R	                  S5      $ )zCheck if the uri is over ssl.OAUTHLIB_INSECURE_TRANSPORTTzhttps://)osenvironr&   lower
startswith)r   s    r   is_secure_transportrG   O   s0    	zz~~34499;!!*--r   )__doc__r8   rC   urllib.parser   r   oauthlib.commonr   r   r   r   r/   r5   r@   rG    r   r   <module>rL      s<     	 ( %](&/.r   