HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/local/lib/python3.9/site-packages/kombu/asynchronous/http/__pycache__/base.cpython-39.pyc
a

X>hC&�@s�dZddlmZddlZddlmZddlmZddlm	Z	m
Z
mZddlm
Z
ddlmZdd	lmZdd
lmZmZer�ddlmZdZeed
�Zedd�dd��ZGdd�de�Ze	jGdd�d��ZGdd�d�Zeefdd��Z Gdd�d�Z!dS)z&Base async HTTP client implementation.�)�annotationsN)�	responses)�
TYPE_CHECKING)�Thenable�
maybe_promise�promise)�	HttpError)�coro)�bytes_to_str)�
maybe_list�memoize)�
TracebackType)�Headers�Response�Request�
BaseClient�pypy_version_infoi�)�maxsizecCsd�dd�|�d�D��S)N�-css|]}|��VqdS�N)�
capitalize)�.0�p�r�F/usr/local/lib/python3.9/site-packages/kombu/asynchronous/http/base.py�	<genexpr>�z#normalize_header.<locals>.<genexpr>)�join�split)�keyrrr�normalize_headersr c@seZdZdZdZdZdS)rz%Represents a mapping of HTTP headers.FN)�__name__�
__module__�__qualname__�__doc__�complete�	_prev_keyrrrrrsrc@s�eZdZdZdZZZZZZ	Z
ZZZ
ZZZdZdZdZdZdZdZes`dZddd	�Zdd
d�Zdd
�ZdS)ra?A HTTP Request.

    Arguments:
    ---------
        url (str): The URL to request.
        method (str): The HTTP method to use (defaults to ``GET``).

    Keyword Arguments:
    -----------------
        headers (Dict, ~kombu.asynchronous.http.Headers): Optional headers for
            this request
        body (str): Optional body for this request.
        connect_timeout (float): Connection timeout in float seconds
            Default is 30.0.
        timeout (float): Time in float seconds before the request times out
            Default is 30.0.
        follow_redirects (bool): Specify if the client should follow redirects
            Enabled by default.
        max_redirects (int): Maximum number of redirects (default 6).
        use_gzip (bool): Allow the server to use gzip compression.
            Enabled by default.
        validate_cert (bool): Set to true if the server certificate should be
            verified when performing ``https://`` requests.
            Enabled by default.
        auth_username (str): Username for HTTP authentication.
        auth_password (str): Password for HTTP authentication.
        auth_mode (str): Type of HTTP authentication (``basic`` or ``digest``).
        user_agent (str): Custom user agent for this request.
        network_interface (str): Network interface to use for this request.
        on_ready (Callable): Callback to be called when the response has been
            received. Must accept single ``response`` argument.
        on_stream (Callable): Optional callback to be called every time body
            content has been read from the socket.  If specified then the
            response body and buffer attributes will not be available.
        on_timeout (callable): Optional callback to be called if the request
            times out.
        on_header (Callable): Optional callback to be called for every header
            line received from the server.  The signature
            is ``(headers, line)`` and note that if you want
            ``response.headers`` to be populated then your callback needs to
            also call ``client.on_header(headers, line)``.
        on_prepare (Callable): Optional callback that is implementation
            specific (e.g. curl client will pass the ``curl`` instance to
            this callback).
        proxy_host (str): Optional proxy host.  Note that a ``proxy_port`` must
            also be provided or a :exc:`ValueError` will be raised.
        proxy_username (str): Optional username to use when logging in
            to the proxy.
        proxy_password (str): Optional password to use when authenticating
            with the proxy server.
        ca_certs (str): Custom CA certificates file to use.
        client_key (str): Optional filename for client SSL key.
        client_cert (str): Optional filename for client SSL certificate.
    Ng>@T�)
�url�method�on_ready�
on_timeout�	on_stream�
on_prepare�	on_header�headers�__weakref__�__dict__�GETc	Ks�||_|p|j|_t|�pt�|_t|�|_t|�|_t|�|_t|�|_|	rl|	�	�D]\}
}t
||
|�qVt|t�s�t|p~i�}||_
dSr)r(r)rrr*r+r,r-r.�items�setattr�
isinstancerr/)�selfr(r)r*r+r,r-r.r/�kwargs�k�vrrr�__init__ts




zRequest.__init__cCs|j�||�dSr)r*�then)r6�callbackZerrbackrrrr;�szRequest.thencCs
d�|�S)Nz&<Request: {0.method} {0.url} {0.body}>)�format�r6rrr�__repr__�szRequest.__repr__)r2NNNNNN)N)r!r"r#r$�body�
user_agentZnetwork_interfaceZ
auth_usernameZ
auth_passwordZ	auth_mode�
proxy_host�
proxy_port�proxy_username�proxy_password�ca_certsZ
client_key�client_cert�connect_timeout�request_timeoutZfollow_redirects�
max_redirectsZuse_gzipZ
validate_cert�PYPY�	__slots__r:r;r?rrrrr*sD:����������

rc@sNeZdZdZesdZddd�Zdd�Zedd	��Z	ed
d��Z
edd
��ZdS)ra	HTTP Response.

    Arguments
    ---------
        request (~kombu.asynchronous.http.Request): See :attr:`request`.
        code (int): See :attr:`code`.
        headers (~kombu.asynchronous.http.Headers): See :attr:`headers`.
        buffer (bytes): See :attr:`buffer`
        effective_url (str): See :attr:`effective_url`.
        status (str): See :attr:`status`.

    Attributes
    ----------
        request (~kombu.asynchronous.http.Request): object used to
            get this response.
        code (int): HTTP response code (e.g. 200, 404, or 500).
        headers (~kombu.asynchronous.http.Headers): HTTP headers
            for this response.
        buffer (bytes): Socket read buffer.
        effective_url (str): The destination url for this request after
            following redirects.
        error (Exception): Error instance if the request resulted in
            a HTTP error code.
        status (str): Human equivalent of :attr:`code`,
            e.g. ``OK``, `Not found`, or 'Internal Server Error'.
    )	�request�coder/�buffer�
effective_url�error�status�_bodyr0NcCs�||_||_|dur|nt�|_||_|p.|j|_d|_|pHt�	|jd�|_
||_|jdur�|jdksp|jdkr�t|j|j
|�|_dS)N�Unknown��i+)
rMrNrr/rOr(rPrSr�getrRrQr)r6rMrNr/rOrPrQrRrrrr:�szResponse.__init__cCs|jr|j�dS)z�Raise if the request resulted in an HTTP error code.

        Raises
        ------
            :class:`~kombu.exceptions.HttpError`
        N)rQr>rrr�raise_for_error�szResponse.raise_for_errorcCs&|jdur |jdur |j��|_|jS)z�The full contents of the response body.

        Note:
        ----
            Accessing this property will evaluate the buffer
            and subsequent accesses will be cached.
        N)rSrO�getvaluer>rrrr@�s	

z
Response.bodycCs|jSr)rNr>rrr�status_code�szResponse.status_codecCs|jSr)r@r>rrr�content�szResponse.content)NNNNN)r!r"r#r$rKrLr:rW�propertyr@rYrZrrrrr�s�



rccs�dV\}}|�d�rqq|s&d|_qq|d��rZ|j}d�|�|�pHd|��g�||<q|�dd�\}}||�}|_|��||<qdS)NzHTTP/Tr� ��:�)	�
startswithr%�isspacer&rrV�lstripr�strip)Zkeyt�liner/�pkeyr�valuerrr�
header_parser�s

"rgc@s`eZdZdZeZeZeZdd�Zdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zddddd�dd�Z
dS)rz�Base class for HTTP clients.

    This class provides the basic structure and functionality for HTTP clients.
    Subclasses should implement specific HTTP client behavior.
    cKs||_t�|_dSr)�hubrg�_header_parser)r6rhr7rrrr:�szBaseClient.__init__cKs>t|�p
gD],}t||j�s.|j|fi|��}|�|�qdSr)rr5r�add_request)r6rMr7�reqrrr�perform�szBaseClient.performcCstd��dS)Nzmust implement add_request)�NotImplementedError)r6rMrrrrjszBaseClient.add_requestcCsdSrrr>rrr�closeszBaseClient.closecCs8z|j�t|�|f�Wnty2t�|_Yn0dSr)ri�sendr
�
StopIterationrg)r6r/rdrrrr.	szBaseClient.on_headercCs|Srrr>rrr�	__enter__szBaseClient.__enter__ztype[BaseException] | NonezBaseException | NonezTracebackType | None�None)�exc_type�exc_val�exc_tb�returncCs|��dSr)rn)r6rsrtrurrr�__exit__szBaseClient.__exit__N)r!r"r#r$rrrr:rlrjrnr.rqrwrrrrr�sr)"r$�
__future__r�sys�http.clientr�typingrZvinerrrZkombu.exceptionsrZkombu.utils.compatr	Zkombu.utils.encodingr
Zkombu.utils.functionalrr�typesr
�__all__�hasattrrKr �dictr�registerrrrgrrrrr�<module>s,


aP