
    ei                     p   g d Z ddlmZmZmZ ddlmZ ddlmZm	Z	 ddl
mZ ddlmZmZ dd	lmZmZmZ dd
lmZmZ ddlmZmZmZmZmZmZmZmZ ddlm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z& er G d ded          Z'neZ'	 	 	 d#dede(dee         dee)         dee*         dee         defdZ+de(dee'         defdZ,de(dee'         defdZ-de(dee'         defdZ.de(dee'         defdZ/de(dee'         defdZ0de(dee'         defdZ1de(dee'         defd Z2de(dee'         defd!Z3de(dee'         defd"Z4dS )$)SessionAsyncSessionBrowserTypeBrowserTypeLiteral
CurlWsFlagrequestheadgetpostputpatchdeleteoptionsRequestsErrorCookiesHeadersRequestResponseAsyncWebSocket	WebSocketWebSocketErrorWebSocketClosedWebSocketTimeoutWebSocketRetryStrategyWsCloseCodeExtraFingerprintsRetryStrategyCookieTypesHeaderTypes	ProxySpec    )OptionalTYPE_CHECKING	TypedDict   )r      )r   r   )r   )r   r   )r   r   r   )r   r   )r   
HttpMethodr   r   r   
ThreadTypeRequestParamsUnpack)r   r   r   r   r   r   r   c                   R    e Zd ZU ee         ed<   ee         ed<   ee         ed<   dS )SessionRequestParamsthreadcurl_optionsdebugN)__name__
__module____qualname__r!   r'   __annotations__dictbool     F/usr/local/lib/python3.11/dist-packages/curl_cffi/requests/__init__.pyr+   r+   @   sC         $$$$tn$$$~r6   r+   F)totalNmethodurlr,   r-   r.   kwargsreturnc                     |dn|}t          |||          5 } |j        d| |d|cddd           S # 1 swxY w Y   dS )aP  Send an http request.

    Parameters:
        method: http method for the request: GET/POST/PUT/DELETE etc.
        url: url for the requests.
        params: query string for the requests.
        data: form values(dict/list/tuple) or binary data to use in body,
            ``Content-Type: application/x-www-form-urlencoded`` will be added if a dict
            is given.
        json: json values to use in body, `Content-Type: application/json` will be added
            automatically.
        headers: headers to send.
        cookies: cookies to use.
        files: not supported, use ``multipart`` instead.
        auth: HTTP basic auth, a tuple of (username, password), only basic auth is
            supported.
        timeout: how many seconds to wait before giving up.
        allow_redirects: whether to allow redirection.
        max_redirects: max redirect counts, default 30, use -1 for unlimited.
        proxies: dict of proxies to use, prefer to use ``proxy`` if they are the same.
            format: ``{"http": proxy_url, "https": proxy_url}``.
        proxy: proxy to use, format: "http://user@pass:proxy_url".
            Can't be used with `proxies` parameter.
        proxy_auth: HTTP basic auth for proxy, a tuple of (username, password).
        verify: whether to verify https certs.
        referer: shortcut for setting referer header.
        accept_encoding: shortcut for setting accept-encoding header.
        content_callback: a callback function to receive response body.
            ``def callback(chunk: bytes) -> None:``
        impersonate: which browser version to impersonate.
        ja3: ja3 string to impersonate.
        akamai: akamai string to impersonate.
        extra_fp: extra fingerprints options, in complement to ja3 and akamai strings.
        thread: thread engine to use for working with other thread implementations.
            choices: eventlet, gevent.
        default_headers: whether to set default browser headers when impersonating.
        default_encoding: encoding for decoding response content if charset is not found
            in headers. Defaults to "utf-8". Can be set to a callable for automatic
            detection.
        quote: Set characters to be quoted, i.e. percent-encoded. Default safe string
            is ``!#$%&'()*+,/:;=?@[]~``. If set to a sting, the character will be
            removed from the safe string, thus quoted. If set to False, the url will be
            kept as is, without any automatic percent-encoding, you must encode the URL
            yourself.
        curl_options: extra curl options to use.
        http_version: limiting http version, defaults to http2.
        debug: print extra curl debug info.
        interface: which interface to use.
        cert: a tuple of (cert, key) filenames for client cert.
        stream: streaming the response, default False.
        max_recv_speed: maximum receive speed, bytes per second.
        multipart: upload files using the multipart format, see examples for details.
        discard_cookies: discard cookies from server. Default to False.

    Returns:
        A ``Response`` object.
    NF)r,   r-   r.   r9   r:   r5   )r   r   )r9   r:   r,   r-   r.   r;   ss          r7   r   r   I   s    B ]EEE	\	G	G	G ;1qy:C::6::; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;s   6::c                      t          dd| d|S )NHEADr>   r5   r   r:   r;   s     r7   r   r          4&c44V444r6   c                      t          dd| d|S )NGETr>   r5   rB   rC   s     r7   r	   r	          3%S33F333r6   c                      t          dd| d|S )NPOSTr>   r5   rB   rC   s     r7   r
   r
      rD   r6   c                      t          dd| d|S )NPUTr>   r5   rB   rC   s     r7   r   r      rG   r6   c                      t          dd| d|S )NPATCHr>   r5   rB   rC   s     r7   r   r          5's55f555r6   c                      t          dd| d|S )NDELETEr>   r5   rB   rC   s     r7   r   r      s    6(66v666r6   c                      t          dd| d|S )NOPTIONSr>   r5   rB   rC   s     r7   r   r      s    7)77777r6   c                      t          dd| d|S )NTRACEr>   r5   rB   rC   s     r7   tracerU      rN   r6   c                      t          dd| d|S )NQUERYr>   r5   rB   rC   s     r7   queryrX      rN   r6   )NNN)5__all__typingr!   r"   r#   constr   cookiesr   r   errorsr   headersr   r   impersonater   r   r   modelsr   r   sessionr   r&   r   r   r   r'   r(   r)   
websocketsr   r   r   r   r   r   r   r+   strr3   r4   r   r   r	   r
   r   r   r   r   rU   rX   r5   r6   r7   <module>rd      s    B 6 5 5 5 5 5 5 5 5 5       ) ) ) ) ) ) ) ) ! ! ! ! ! ! ) ) ) ) ) ) ) ) K K K K K K K K K K % % % % % % % %	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	                   %    }E      % $(#' C; C;C;	C; Z C; 4.	C;
 D>C; ]#C; C; C; C; C;L5c 5V$89 5h 5 5 5 54S 4F#78 4X 4 4 4 45c 5V$89 5h 5 5 5 54S 4F#78 4X 4 4 4 46s 6f%9: 6x 6 6 6 67 7v&:; 7 7 7 7 78 8'; < 8 8 8 8 86s 6f%9: 6x 6 6 6 66s 6f%9: 6x 6 6 6 6 6 6r6   