
    GVhX*                    ~   S SK Jr  S SKrS SKrS SKJr  S SKJrJr  \R                  S::  a  S SK
Jr  OS SKJr  SSKJr  \(       a  SS	KJrJrJrJrJrJr  O " S
 S5      r\" 5       r\=rr " S S\5      r " S S\5      r    S             SS jjrSS jrSS jrSS jrSS jrSS jrSS jrSS jrg)    )annotationsN)partial)TYPE_CHECKING	TypedDict)      )Unpack   )RClient)IMPERSONATEIMPERSONATE_OSClientRequestParams
HttpMethodRequestParamsResponsec                  $    \ rS rSr\S 5       rSrg)_Unpack   c                     g N )argskwargss     H/home/james-whalen/.local/lib/python3.13/site-packages/primp/__init__.py__getitem___Unpack.__getitem__   s        r   N)__name__
__module____qualname____firstlineno__staticmethodr   __static_attributes__r   r   r   r   r      s    		 
	r   r   c                     ^  \ rS rSrSr                S                               SU 4S jjjrSS jrS rSU 4S jjrSS jr	SS jr
SS	 jrSS
 jrSS jrSS jrSS jrSrU =r$ )Client   z=Initializes an HTTP client that can impersonate web browsers.c                "   > [         TU ]  5         g)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*   Client.__init__    s    n 	r   c                    U $ r   r   r+   s    r   	__enter__Client.__enter__Y   s    r   c                    A g r   r   r+   r   s     r   __exit__Client.__exit__\   s    r   c                (   > [         TU ]  " SXS.UD6$ )Nmethodurlr   )r)   requestr+   rH   rI   r   r<   s       r   rJ   Client.request_   s    w@f@@@r   c                ,    U R                   " SSUS.UD6$ NGETrG   r   rJ   r+   rI   r   s      r   get
Client.getb       ||<5c<V<<r   c                ,    U R                   " SSUS.UD6$ NHEADrG   r   rP   rQ   s      r   headClient.heade       ||=6s=f==r   c                ,    U R                   " SSUS.UD6$ NOPTIONSrG   r   rP   rQ   s      r   optionsClient.optionsh   s    ||@9#@@@r   c                ,    U R                   " SSUS.UD6$ NDELETErG   r   rP   rQ   s      r   deleteClient.deletek   s    ||?8???r   c                ,    U R                   " SSUS.UD6$ NPOSTrG   r   rP   rQ   s      r   postClient.postn   rZ   r   c                ,    U R                   " SSUS.UD6$ NPUTrG   r   rP   rQ   s      r   put
Client.putq   rT   r   c                ,    U R                   " SSUS.UD6$ NPATCHrG   r   rP   rQ   s      r   patchClient.patcht   s    ||>7>v>>r   r   )NNNNTTN   NNTr   TNFF) r,   ztuple[str, str | None] | Noner-   
str | Noner.   dict[str, str] | Noner/   rv   r0   bool | Noner1   rw   r2   ru   r3   zfloat | Noner4   IMPERSONATE | Noner5   IMPERSONATE_OS | Noner6   rw   r7   z
int | Noner8   rw   r9   ru   r:   rw   r;   rw   )returnr%   )rH   r   rI   strr   Unpack[RequestParams]rz   r   )rI   r{   r   r|   rz   r   )r   r   r    r!   __doc__r*   r@   rD   rJ   rR   rX   r^   rc   rh   rm   rr   r#   __classcell__r<   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 7rA=>A@>=? ?r   r%   c                     ^  \ rS rSrU 4S jrSS jrS rS rSU 4S jjrSS jr	SS jr
SS	 jrSS
 jrSS jrSS jrSS jrSrU =r$ )AsyncClientx   c                &   > [         TU ]  " U0 UD6  g r   r(   )r+   r   r   r<   s      r   r*   AsyncClient.__init__y   s    $)&)r   c                   #    U $ 7fr   r   r?   s    r   
__aenter__AsyncClient.__aenter__|   s
        c                   #    A g 7fr   r   rC   s     r   	__aexit__AsyncClient.__aexit__   s     r   c                   #    [         R                  " 5       nUR                  S [        U/UQ70 UD65      I S h  vN $  N7fr   )asyncioget_running_looprun_in_executorr   )r+   fnr   r   loops        r   _run_sync_asyncioAsyncClient._run_sync_asyncio   s;     '')))$0LT0LV0LMMMMs   8A?Ac                Z   >#    U R                   " [        TU ]  4XS.UD6I S h  vN $  N7f)NrG   )r   r)   rJ   rK   s       r   rJ   AsyncClient.request   s,     ++EGO^F^W]^^^^s   !+)+c                H   #    U R                   " SSUS.UD6I S h  vN $  N7frN   rP   rQ   s      r   rR   AsyncClient.get   $     \\BCB6BBBB   " "c                H   #    U R                   " SSUS.UD6I S h  vN $  N7frV   rP   rQ   s      r   rX   AsyncClient.head   $     \\CSCFCCCCr   c                H   #    U R                   " SSUS.UD6I S h  vN $  N7fr\   rP   rQ   s      r   r^   AsyncClient.options   s$     \\FFvFFFFr   c                H   #    U R                   " SSUS.UD6I S h  vN $  N7fra   rP   rQ   s      r   rc   AsyncClient.delete   s$     \\EsEfEEEEr   c                H   #    U R                   " SSUS.UD6I S h  vN $  N7frf   rP   rQ   s      r   rh   AsyncClient.post   r   r   c                H   #    U R                   " SSUS.UD6I S h  vN $  N7frk   rP   rQ   s      r   rm   AsyncClient.put   r   r   c                H   #    U R                   " SSUS.UD6I S h  vN $  N7frp   rP   rQ   s      r   rr   AsyncClient.patch   s$     \\DcDVDDDDr   r   )rz   r   )rH   r   rI   r{   r   r|   )rI   r{   r   r|   )r   r   r    r!   r*   r   r   r   rJ   rR   rX   r^   rc   rh   rm   rr   r#   r~   r   s   @r   r   r   x   sN    *N_CDGFDCE Er   r   c                v    [        UUUUS9 nUR                  " X40 UD6sSSS5        $ ! , (       d  f       g= f)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.
)r4   r5   r8   r9   N)r%   rJ   )rH   rI   r4   r5   r8   r9   r   clients           r   rJ   rJ      s?    X 
%!	

 
~~f4V4
 
 
s   *
8c                    [        SSU S.UD6$ rN   rP   rI   r   s     r   rR   rR          3%S3F33r   c                    [        SSU S.UD6$ rV   rP   r   s     r   rX   rX          4&c4V44r   c                    [        SSU S.UD6$ r\   rP   r   s     r   r^   r^      s    7)777r   c                    [        SSU S.UD6$ ra   rP   r   s     r   rc   rc      s    6(6v66r   c                    [        SSU S.UD6$ rf   rP   r   s     r   rh   rh      r   r   c                    [        SSU S.UD6$ rk   rP   r   s     r   rm   rm      r   r   c                    [        SSU S.UD6$ rp   rP   r   s     r   rr   rr      s    5's5f55r   )NNTN)rH   r   rI   r{   r4   rx   r5   ry   r8   rw   r9   ru   r   r|   )rI   r{   r   zUnpack[ClientRequestParams])
__future__r   r   sys	functoolsr   typingr   r   version_infotyping_extensionsr	   primpr   r   r   r   r   r   r   r   r%   r   rJ   rR   rX   r^   rc   rh   rm   rr   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   