
    ǁiX*                    `   d dl mZ d dlZd dlZd dlmZ d dlmZmZ ej                  dk  rd dl
mZ nd dlmZ ddlmZ erdd	lmZmZmZmZmZmZ n G d
 d      Z e       ZexZZ G d de      Z G d de      Z	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddZddZddZddZddZddZddZy)    )annotationsN)partial)TYPE_CHECKING	TypedDict)      )Unpack   )RClient)IMPERSONATEIMPERSONATE_OSClientRequestParams
HttpMethodRequestParamsResponsec                      e Zd Zed        Zy)_Unpackc                      y N )argskwargss     X/home/obispo/Crisostomo_bridge/mision_env/lib/python3.12/site-packages/primp/__init__.py__getitem__z_Unpack.__getitem__   s        N)__name__
__module____qualname__staticmethodr   r   r   r   r   r      s    		 
	r   r   c                       e Zd ZdZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d fdZddZd Zd fdZddZddZ	ddZ
dd	Zdd
ZddZddZ xZS )Clientz=Initializes an HTTP client that can impersonate web browsers.c                "    t         |           y)a
  
        Args:
            auth: a tuple containing the username and an optional password for basic authentication. Default is None.
            auth_bearer: a string representing the bearer token for bearer token authentication. Default is None.
            params: a map of query parameters to append to the URL. Default is None.
            headers: an optional map of HTTP headers to send with requests. Ignored if `impersonate` is set.
            cookie_store: enable a persistent cookie store. Received cookies will be preserved and included
                 in additional requests. Default is True.
            referer: automatic setting of the `Referer` header. Default is True.
            proxy: proxy URL for HTTP requests, example: "socks5://127.0.0.1:9150". Default is None.
            timeout: timeout for HTTP requests in seconds. Default is 30.
            impersonate: impersonate browser. Supported browsers:
                "chrome_100", "chrome_101", "chrome_104", "chrome_105", "chrome_106",
                "chrome_107", "chrome_108", "chrome_109", "chrome_114", "chrome_116",
                "chrome_117", "chrome_118", "chrome_119", "chrome_120", "chrome_123",
                "chrome_124", "chrome_126", "chrome_127", "chrome_128", "chrome_129",
                "chrome_130", "chrome_131", "chrome_133"
                "safari_15.3", "safari_15.5", "safari_15.6.1", "safari_16",
                "safari_16.5", "safari_17.0", "safari_17.2.1", "safari_17.4.1",
                "safari_17.5", "safari_18",  "safari_18.2",
                "safari_ios_16.5", "safari_ios_17.2", "safari_ios_17.4.1", "safari_ios_18.1.1",
                "safari_ipad_18",
                "okhttp_3.9", "okhttp_3.11", "okhttp_3.13", "okhttp_3.14", "okhttp_4.9",
                "okhttp_4.10", "okhttp_5",
                "edge_101", "edge_122", "edge_127", "edge_131",
                "firefox_109", "firefox_117", "firefox_128", "firefox_133", "firefox_135".
                Default is None.
            impersonate_os: impersonate OS. Supported OS:
                "android", "ios", "linux", "macos", "windows". Default is None.
            follow_redirects: a boolean to enable or disable following redirects. Default is True.
            max_redirects: the maximum number of redirects if `follow_redirects` is True. Default is 20.
            verify: an optional boolean indicating whether to verify SSL certificates. Default is True.
            ca_cert_file: path to CA certificate store. Default is None.
            https_only: restrict the Client to be used with HTTPS only requests. Default is False.
            http2_only: if true - use only HTTP/2, if false - use only HTTP/1. Default is False.
        Nsuper__init__)selfauthauth_bearerparamsheaderscookie_storerefererproxytimeoutimpersonateimpersonate_osfollow_redirectsmax_redirectsverifyca_cert_file
https_only
http2_only	__class__s                    r   r%   zClient.__init__    s    n 	r   c                    | S r   r   r&   s    r   	__enter__zClient.__enter__Y   s    r   c                     ~ y r   r   r&   r   s     r   __exit__zClient.__exit__\   s    r   c                (    t        |   d||d|S )Nmethodurlr   )r$   requestr&   r@   rA   r   r7   s       r   rB   zClient.request_   s    w@f#@@@r   c                ,     | j                   dd|d|S NGETr?   r   rB   r&   rA   r   s      r   getz
Client.getb       t||<5c<V<<r   c                ,     | j                   dd|d|S NHEADr?   r   rG   rH   s      r   headzClient.heade       t||=6s=f==r   c                ,     | j                   dd|d|S NOPTIONSr?   r   rG   rH   s      r   optionszClient.optionsh   s    t||@9#@@@r   c                ,     | j                   dd|d|S NDELETEr?   r   rG   rH   s      r   deletezClient.deletek   s    t||?8???r   c                ,     | j                   dd|d|S NPOSTr?   r   rG   rH   s      r   postzClient.postn   rO   r   c                ,     | j                   dd|d|S NPUTr?   r   rG   rH   s      r   putz
Client.putq   rJ   r   c                ,     | j                   dd|d|S NPATCHr?   r   rG   rH   s      r   patchzClient.patcht   s    t||>7>v>>r   )NNNNTTN   NNT   TNFF) r'   ztuple[str, str | None] | Noner(   
str | Noner)   dict[str, str] | Noner*   rg   r+   bool | Noner,   rh   r-   rf   r.   zfloat | Noner/   IMPERSONATE | Noner0   IMPERSONATE_OS | Noner1   rh   r2   z
int | Noner3   rh   r4   rf   r5   rh   r6   rh   )returnr!   )r@   r   rA   strr   Unpack[RequestParams]rk   r   )rA   rl   r   rm   rk   r   )r   r   r   __doc__r%   r:   r=   rB   rI   rN   rS   rW   r[   r_   rc   __classcell__r7   s   @r   r!   r!      s   G /3"&(,)-$(#  "*.04(,$&"#'"'"'#7+7  7 &	7
 '7 "7 7 7 7 (7 .7 &7 "7 7 !7   !7"  #7rA=>A@>=?r   r!   c                  v     e Zd Z fdZddZd Zd Zd fdZddZddZ	ddZ
dd	Zdd
ZddZddZ xZS )AsyncClientc                $    t        |   |i | y r   r#   )r&   r   r   r7   s      r   r%   zAsyncClient.__init__y   s    $)&)r   c                   K   | S wr   r   r9   s    r   
__aenter__zAsyncClient.__aenter__|   s        c                   K   ~ y wr   r   r<   s     r   	__aexit__zAsyncClient.__aexit__   s	     rv   c                   K   t        j                         }|j                  d t        |g|i |       d {   S 7 wr   )asyncioget_running_looprun_in_executorr   )r&   fnr   r   loops        r   _run_sync_asynciozAsyncClient._run_sync_asyncio   s<     '')))$0LT0LV0LMMMMs   7A >A c                \   K    | j                   t        |   f||d| d {   S 7 w)Nr?   )r   r$   rB   rC   s       r   rB   zAsyncClient.request   s2     +T++EGO^FPS^W]^^^^s   ",*,c                H   K    | j                   dd|d| d {   S 7 wrE   rG   rH   s      r   rI   zAsyncClient.get   '     !T\\BCB6BBBB   " "c                H   K    | j                   dd|d| d {   S 7 wrL   rG   rH   s      r   rN   zAsyncClient.head   '     !T\\CSCFCCCCr   c                H   K    | j                   dd|d| d {   S 7 wrQ   rG   rH   s      r   rS   zAsyncClient.options   s'     !T\\FFvFFFFr   c                H   K    | j                   dd|d| d {   S 7 wrU   rG   rH   s      r   rW   zAsyncClient.delete   s'     !T\\EsEfEEEEr   c                H   K    | j                   dd|d| d {   S 7 wrY   rG   rH   s      r   r[   zAsyncClient.post   r   r   c                H   K    | j                   dd|d| d {   S 7 wr]   rG   rH   s      r   r_   zAsyncClient.put   r   r   c                H   K    | j                   dd|d| d {   S 7 wra   rG   rH   s      r   rc   zAsyncClient.patch   s'     !T\\DcDVDDDDr   )rk   rr   )r@   r   rA   rl   r   rm   )rA   rl   r   rm   )r   r   r   r%   ru   rx   r   rB   rI   rN   rS   rW   r[   r_   rc   ro   rp   s   @r   rr   rr   x   sH    *N_CDGFDCEr   rr   c                t    t        ||||      5 } |j                  | |fi |cddd       S # 1 sw Y   yxY w)a	  
    Args:
        method: the HTTP method to use (e.g., "GET", "POST").
        url: the URL to which the request will be made.
        impersonate: impersonate browser. Supported browsers:
            "chrome_100", "chrome_101", "chrome_104", "chrome_105", "chrome_106",
            "chrome_107", "chrome_108", "chrome_109", "chrome_114", "chrome_116",
            "chrome_117", "chrome_118", "chrome_119", "chrome_120", "chrome_123",
            "chrome_124", "chrome_126", "chrome_127", "chrome_128", "chrome_129",
            "chrome_130", "chrome_131", "chrome_133",
            "safari_15.3", "safari_15.5", "safari_15.6.1", "safari_16",
            "safari_16.5", "safari_17.0", "safari_17.2.1", "safari_17.4.1",
            "safari_17.5", "safari_18",  "safari_18.2",
            "safari_ios_16.5", "safari_ios_17.2", "safari_ios_17.4.1", "safari_ios_18.1.1",
            "safari_ipad_18",
            "okhttp_3.9", "okhttp_3.11", "okhttp_3.13", "okhttp_3.14", "okhttp_4.9",
            "okhttp_4.10", "okhttp_5",
            "edge_101", "edge_122", "edge_127", "edge_131",
            "firefox_109", "firefox_117", "firefox_128", "firefox_133", "firefox_135".
            Default is None.
        impersonate_os: impersonate OS. Supported OS:
            "android", "ios", "linux", "macos", "windows". Default is None.
        verify: an optional boolean indicating whether to verify SSL certificates. Default is True.
        ca_cert_file: path to CA certificate store. Default is None.
        auth: a tuple containing the username and an optional password for basic authentication. Default is None.
        auth_bearer: a string representing the bearer token for bearer token authentication. Default is None.
        params: a map of query parameters to append to the URL. Default is None.
        headers: an optional map of HTTP headers to send with requests. If `impersonate` is set, this will be ignored.
        cookies: an optional map of cookies to send with requests as the `Cookie` header.
        timeout: the timeout for the request in seconds. Default is 30.
        content: the content to send in the request body as bytes. Default is None.
        data: the form data to send in the request body. Default is None.
        json: a JSON serializable object to send in the request body. Default is None.
        files: a map of file fields to file paths to be sent as multipart/form-data. Default is None.
    )r/   r0   r3   r4   N)r!   rB   )r@   rA   r/   r0   r3   r4   r   clients           r   rB   rB      sH    X 
%!	
 5
 
v~~fc4V45 5 5s   .7c                    t        dd| d|S rE   rG   rA   r   s     r   rI   rI          3%S3F33r   c                    t        dd| d|S rL   rG   r   s     r   rN   rN          4&c4V44r   c                    t        dd| d|S rQ   rG   r   s     r   rS   rS      s    7)777r   c                    t        dd| d|S rU   rG   r   s     r   rW   rW      s    6(6v66r   c                    t        dd| d|S rY   rG   r   s     r   r[   r[      r   r   c                    t        dd| d|S r]   rG   r   s     r   r_   r_      r   r   c                    t        dd| d|S ra   rG   r   s     r   rc   rc      s    5's5f55r   )NNTN)r@   r   rA   rl   r/   ri   r0   rj   r3   rh   r4   rf   r   rm   )rA   rl   r   zUnpack[ClientRequestParams])
__future__r   rz   sys	functoolsr   typingr   r   version_infotyping_extensionsr	   primpr   r   r   r   r   r   r   r   r!   rr   rB   rI   rN   rS   rW   r[   r_   rc   r   r   r   <module>r      s    "  
  +w( lll 
 YF*33M'X?W X?v$E& $ET '+,0#2525	25 $25 *	25
 25 25 $25j4587546r   