o
    ùT·j’& ã                   @  sŒ  d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlm	Z	m
Z
 d dlmZmZ d dlmZ ddlmZ ddlmZmZmZ dd	lmZmZmZmZmZmZmZmZmZmZm Z  dd
l!m"Z" ddl#m$Z$m%Z%m&Z&m'Z' ddl(m)Z)m*Z*m+Z+m,Z, ddl-m.Z. ddl/m0Z0 ddl1m2Z2m3Z3 ddl4m5Z5m6Z6 ddl7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZD ddlEmFZFmGZG ddlHmIZImJZJ ejKrÕd dlLZLddlMmNZNmOZO g d¢ZPejQddd�ZRejQddd�ZSd4d d!„ZTG d"d#„ d#ƒZUeUƒ ZVe Wd$¡ZXd%e› �ZYd& Zd'd(„ e" [¡ D ƒ¡Z\G d)d*„ d*ej]ƒZ^G d+d,„ d,eCƒZ_G d-d.„ d.e8ƒZ`ejad/ejbf ZcG d0d1„ d1ƒZdG d2d„ dedƒZeG d3d„ dedƒZfdS )5é    )ÚannotationsN)ÚAsyncGeneratorÚ	Generator)ÚasynccontextmanagerÚcontextmanager)ÚTracebackTypeé   )Ú__version__)ÚAuthÚ	BasicAuthÚFunctionAuth)Ú'DEFAULT_KEEPALIVE_PING_INTERVAL_SECONDSÚ&DEFAULT_KEEPALIVE_PING_TIMEOUT_SECONDSÚDEFAULT_LIMITSÚDEFAULT_MAX_EVENT_SIZE_BYTESÚDEFAULT_MAX_MESSAGE_SIZE_BYTESÚDEFAULT_MAX_REDIRECTSÚDEFAULT_QUEUE_SIZEÚDEFAULT_TIMEOUT_CONFIGÚLimitsÚProxyÚTimeout)ÚSUPPORTED_DECODERS)Ú
InvalidURLÚRemoteProtocolErrorÚTooManyRedirectsÚrequest_context)ÚCookiesÚHeadersÚRequestÚResponse)ÚEventSource)Úcodes)ÚAsyncHTTPTransportÚHTTPTransport)ÚAsyncBaseTransportÚBaseTransport)ÚAsyncByteStreamÚ	AuthTypesÚ	CertTypesÚCookieTypesÚHeaderTypesÚ
ProxyTypesÚQueryParamTypesÚRequestContentÚRequestDataÚRequestExtensionsÚRequestFilesÚSyncByteStreamÚTimeoutTypes)ÚURLÚQueryParams)Ú
URLPatternÚget_environment_proxies)ÚAsyncWebSocketSessionÚWebSocketSession)ÚUSE_CLIENT_DEFAULTÚAsyncClientÚClientÚTr<   )ÚboundÚUr;   Úurlr4   ÚlocationÚreturnÚboolc                 C  s@   | j }|j }|j|jko|jdko|jdko|jdko|jdkS )zA
    Return 'True' if 'location' is a HTTPS upgrade of 'url'
    ÚhttpéP   Úhttpsi»  )ÚoriginÚhostÚschemeÚport)r@   rA   rG   Úlocation_origin© rL   úQ/home/dinkstrade/pdmp-scanner/venv/lib/python3.10/site-packages/httpx2/_client.pyÚ_is_https_redirectG   s   ÿþýûrN   c                   @  s   e Zd ZdZdS )ÚUseClientDefaulta<  
    For some parameters such as `auth=...` and `timeout=...` we need to be able
    to indicate the default "unset" state, in a way that is distinctly different
    to using `None`.

    The default "unset" state indicates that whatever default is set on the
    client should be used. This is different to setting `None`, which
    explicitly disables the parameter, possibly overriding a client default.

    For example we use `timeout=USE_CLIENT_DEFAULT` in the `request()` signature.
    Omitting the `timeout` parameter will send a request using whatever default
    timeout has been configured on the client. Including `timeout=None` will
    ensure no timeout is used.

    Note that user code shouldn't need to use the `USE_CLIENT_DEFAULT` constant,
    but it is used internally when a parameter is not included.
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rL   rL   rL   rM   rO   W   s    rO   Úhttpx2zpython-httpx2/z, c                 C  s   g | ]}|d kr|‘qS )ÚidentityrL   )Ú.0ÚkeyrL   rL   rM   Ú
<listcomp>q   s    rX   c                   @  s   e Zd ZdZdZdZdS )ÚClientStater   é   é   N)rP   rQ   rR   ÚUNOPENEDÚOPENEDÚCLOSEDrL   rL   rL   rM   rY   t   s    rY   c                   @  ó.   e Zd ZdZddd	„Zddd„Zddd„ZdS )ÚBoundSyncStreamzÒ
    A byte stream that tracks elapsed time for a response. Once closed, the
    elapsed time is available via the `elapsed` attribute, and the response
    can read it back from `response.stream.elapsed`.
    Ústreamr2   ÚstartÚfloatrB   ÚNonec                 C  ó   || _ || _d | _d S ©N©Ú_streamÚ_startÚelapsed©Úselfra   rb   rL   rL   rM   Ú__init__‰   ó   
zBoundSyncStream.__init__útyping.Iterator[bytes]c                 c  s   � | j E d H  d S rf   )rh   ©rl   rL   rL   rM   Ú__iter__Ž   s   €zBoundSyncStream.__iter__c                 C  s&   t jt ¡ | j d�| _| j ¡  d S ©N)Úseconds)ÚdatetimeÚ	timedeltaÚtimeÚperf_counterri   rj   rh   Úcloserp   rL   rL   rM   rx   ‘   s   zBoundSyncStream.closeN)ra   r2   rb   rc   rB   rd   )rB   ro   ©rB   rd   )rP   rQ   rR   rS   rm   rq   rx   rL   rL   rL   rM   r`   ‚   s
    

r`   c                   @  r_   )ÚBoundAsyncStreamzÙ
    An async byte stream that tracks elapsed time for a response. Once closed,
    the elapsed time is available via the `elapsed` attribute, and the response
    can read it back from `response.stream.elapsed`.
    ra   r'   rb   rc   rB   rd   c                 C  re   rf   rg   rk   rL   rL   rM   rm   �   rn   zBoundAsyncStream.__init__útyping.AsyncIterator[bytes]c              	   C sf   �| j  ¡ }z|2 z	3 d H W }|V  q	6 W t|tƒr#| ¡ I d H  d S d S t|tƒr2| ¡ I d H  w w rf   )rh   Ú	__aiter__Ú
isinstancer   Úaclose)rl   ra   ÚchunkrL   rL   rM   r|   ¢   s   €
ÿ
ÿÿzBoundAsyncStream.__aiter__c                 Ã  s.   �t jt ¡ | j d�| _| j ¡ I d H  d S rr   )rt   ru   rv   rw   ri   rj   rh   r~   rp   rL   rL   rM   r~   «   s   €zBoundAsyncStream.acloseN)ra   r'   rb   rc   rB   rd   )rB   r{   ry   )rP   rQ   rR   rS   rm   r|   r~   rL   rL   rL   rM   rz   –   s
    

	rz   .c                   @  sÔ  e Zd Zddddededddddœd|dd„Zed}d d!„ƒZed}d"d#„ƒZd~d&d'„Z	dd,d-„Z
ed€d/d0„ƒZejd�d1d0„ƒZed‚d3d4„ƒZejdƒd5d4„ƒZed„d7d8„ƒZejd…d:d8„ƒZed†d;d<„ƒZejd‡d=d<„ƒZedˆd?d@„ƒZejd‰dBd@„ƒZedŠdDdE„ƒZejd‹dGdE„ƒZedŒdIdJ„ƒZejd�dLdJ„ƒZdddddddeddMœ	dŽd\d]„Zd�d^d_„Zd�d‘d`da„Zd�d’dbdc„Zd�d“ddde„Zd”dfdg„Zefd•dkdl„Zd–dodp„Zd—dqdr„Zd˜dsdt„Zd™dudv„Zdšdxdy„Zd›dzd{„Z dS )œÚ
BaseClientNFÚ Túutf-8©ÚauthÚparamsÚheadersÚcookiesÚtimeoutÚfollow_redirectsÚmax_redirectsÚevent_hooksÚbase_urlÚ	trust_envÚdefault_encodingr„   úAuthTypes | Noner…   úQueryParamTypes | Noner†   úHeaderTypes | Noner‡   úCookieTypes | Nonerˆ   r3   r‰   rC   rŠ   Úintr‹   ú+None | typing.Mapping[str, list[EventHook]]rŒ   ú	URL | strr�   rŽ   ú*str | typing.Callable[[bytes], str | None]rB   rd   c                C  sœ   |d u ri n|}|   t|	ƒ¡| _|  |¡| _t|ƒ| _t|ƒ| _t	|ƒ| _
t|ƒ| _|| _|| _t| dg ¡ƒt| dg ¡ƒdœ| _|
| _|| _tj| _d S ©NÚrequestÚresponse)r˜   r™   )Ú_enforce_trailing_slashr4   Ú	_base_urlÚ_build_authÚ_authr5   Ú_paramsr   r†   r   Ú_cookiesr   Ú_timeoutr‰   rŠ   ÚlistÚgetÚ_event_hooksÚ
_trust_envÚ_default_encodingrY   r\   Ú_state)rl   r„   r…   r†   r‡   rˆ   r‰   rŠ   r‹   rŒ   r�   rŽ   rL   rL   rM   rm   ´   s   



þzBaseClient.__init__c                 C  s   | j tjkS )z2
        Check if the client being closed
        )r¦   rY   r^   rp   rL   rL   rM   Ú	is_closedÖ   s   zBaseClient.is_closedc                 C  ó   | j S rf   )r¤   rp   rL   rL   rM   r�   Ý   ó   zBaseClient.trust_envr@   r4   c                 C  s"   |j  d¡r|S |j|j d d�S )Nó   /©Úraw_path)r¬   ÚendswithÚ	copy_with©rl   r@   rL   rL   rM   rš   á   s   z"BaseClient._enforce_trailing_slashÚproxyúProxyTypes | NoneÚallow_env_proxiesúdict[str, Proxy | None]c                 C  sH   |d u r|rdd„ t ƒ  ¡ D ƒS i S t|ttfƒrt|d�n|}d|iS )Nc                 S  s(   i | ]\}}||d u rd nt |d�“qS )N©r@   )r   )rV   rW   r@   rL   rL   rM   Ú
<dictcomp>é   s   ( z-BaseClient._get_proxy_map.<locals>.<dictcomp>r´   zall://)r7   Úitemsr}   Ústrr4   r   )rl   r°   r²   rL   rL   rM   Ú_get_proxy_mapæ   s   zBaseClient._get_proxy_mapr   c                 C  r¨   rf   )r    rp   rL   rL   rM   rˆ   ï   r©   zBaseClient.timeoutc                 C  ó   t |ƒ| _d S rf   )r   r    )rl   rˆ   rL   rL   rM   rˆ   ó   ó   údict[str, list[EventHook]]c                 C  r¨   rf   )r£   rp   rL   rL   rM   r‹   ÷   r©   zBaseClient.event_hooksc                 C  s(   t | dg ¡ƒt | dg ¡ƒdœ| _d S r—   )r¡   r¢   r£   )rl   r‹   rL   rL   rM   r‹   û   s   þúAuth | Nonec                 C  r¨   )z§
        Authentication class used when none is passed at the request-level.

        See also [Authentication][0].

        [0]: quickstart.md#authentication
        )r�   rp   rL   rL   rM   r„     s   	zBaseClient.authr(   c                 C  s   |   |¡| _d S rf   )rœ   r�   ©rl   r„   rL   rL   rM   r„     s   c                 C  r¨   )zK
        Base URL to use when sending requests with relative URLs.
        )r›   rp   rL   rL   rM   rŒ     ó   zBaseClient.base_urlc                 C  s   |   t|ƒ¡| _d S rf   )rš   r4   r›   r¯   rL   rL   rM   rŒ     s   r   c                 C  r¨   )z@
        HTTP headers to include when sending requests.
        )Ú_headersrp   rL   rL   rM   r†     r¾   zBaseClient.headersr+   c                 C  s2   t dt d¡dt d¡dœƒ}| |¡ || _d S )Ns   */*Úasciis
   keep-alive)s   Accepts   Accept-Encodings
   Connections
   User-Agent)r   ÚACCEPT_ENCODINGÚencodeÚ
USER_AGENTÚupdater¿   )rl   r†   Úclient_headersrL   rL   rM   r†   #  s   üÿ

r   c                 C  r¨   )zA
        Cookie values to include when sending requests.
        )rŸ   rp   rL   rL   rM   r‡   0  r¾   zBaseClient.cookiesr*   c                 C  r¹   rf   )r   rŸ   )rl   r‡   rL   rL   rM   r‡   7  rº   r5   c                 C  r¨   )zO
        Query parameters to include in the URL when sending requests.
        )rž   rp   rL   rL   rM   r…   ;  r¾   zBaseClient.paramsr-   c                 C  r¹   rf   )r5   rž   )rl   r…   rL   rL   rM   r…   B  rº   )	ÚcontentÚdataÚfilesÚjsonr…   r†   r‡   rˆ   Ú
extensionsÚmethodr·   rÆ   úRequestContent | NonerÇ   úRequestData | NonerÈ   úRequestFiles | NonerÉ   útyping.Any | NoneúTimeoutTypes | UseClientDefaultrÊ   úRequestExtensions | Noner   c       	         C  sŽ   |   |¡}|  |¡}|  |	¡}	|  |¡}|du ri n|}d|vr9t|
tƒr(| jnt|
ƒ}
tdi |¤d|
 	¡ i¤Ž}t
|||||||||	|d�
S )aS  
        Build and return a request instance.

        * The `params`, `headers` and `cookies` arguments
        are merged with any values set on the client.
        * The `url` argument is merged with any `base_url` set on the client.

        See also: [Request instances][0]

        [0]: advanced/clients.md#request-instances
        Nrˆ   )rÆ   rÇ   rÈ   rÉ   r…   r†   r‡   rÊ   rL   )Ú
_merge_urlÚ_merge_headersÚ_merge_cookiesÚ_merge_queryparamsr}   rO   rˆ   r   ÚdictÚas_dictr   )rl   rË   r@   rÆ   rÇ   rÈ   rÉ   r…   r†   r‡   rˆ   rÊ   rL   rL   rM   Úbuild_requestF  s(   



özBaseClient.build_requestc                 C  s4   t |ƒ}|jr| jj|j d¡ }| jj|d�S |S )z‹
        Merge a URL argument together with any 'base_url' on the client,
        to create the URL used for the outgoing request.
        rª   r«   )r4   Úis_relative_urlrŒ   r¬   Úlstripr®   )rl   r@   Ú	merge_urlÚmerge_raw_pathrL   rL   rM   rÒ   u  s
   zBaseClient._merge_urlc                 C  s&   |s| j rt| j ƒ}| |¡ |S |S )z�
        Merge a cookies argument together with any cookies on the client,
        to create the cookies used for the outgoing request.
        )r‡   r   rÄ   )rl   r‡   Úmerged_cookiesrL   rL   rM   rÔ   ‹  s
   


zBaseClient._merge_cookiesc                 C  s   t | jƒ}| |¡ |S )z�
        Merge a headers argument together with any headers on the client,
        to create the headers used for the outgoing request.
        )r   r†   rÄ   )rl   r†   Úmerged_headersrL   rL   rM   rÓ   –  s   

zBaseClient._merge_headersc                 C  s"   |s| j rt| j ƒ}| |¡S |S )zœ
        Merge a queryparams argument together with any queryparams on the client,
        to create the queryparams used for the outgoing request.
        )r…   r5   Úmerge)rl   r…   Úmerged_queryparamsrL   rL   rM   rÕ   Ÿ  s   


zBaseClient._merge_queryparamsc                 C  sX   |d u rd S t |tƒrt|d |d d�S t |tƒr|S t|ƒr%t|d�S td|›�ƒ‚)Nr   r   ©ÚusernameÚpassword)ÚfunczInvalid "auth" argument: )r}   Útupler   r
   Úcallabler   Ú	TypeErrorr½   rL   rL   rM   rœ   ©  s   


zBaseClient._build_authr˜   ú#AuthTypes | UseClientDefault | Noner
   c                 C  sR   t |tƒr| jn|  |¡}|d ur|S |jj|jj}}|s |r&t||d�S tƒ S )Nrá   )	r}   rO   r�   rœ   r@   râ   rã   r   r
   )rl   r˜   r„   râ   rã   rL   rL   rM   Ú_build_request_authµ  s   zBaseClient._build_request_authr™   r    c                 C  sR   |   ||¡}|  ||¡}|  |||¡}|  ||¡}t| jƒ}t||||||jd�S )zƒ
        Given a request and a redirect response, return a new request that
        should be used to effect the redirect.
        )rË   r@   r†   r‡   ra   rÊ   )Ú_redirect_methodÚ_redirect_urlÚ_redirect_headersÚ_redirect_streamr   r‡   r   rÊ   )rl   r˜   r™   rË   r@   r†   ra   r‡   rL   rL   rM   Ú_build_redirect_requestÅ  s   
úz"BaseClient._build_redirect_requestc                 C  sR   |j }|jtjkr|dkrd}|jtjkr|dvrd}|jtjkr'|dkr'd}|S )z‹
        When being redirected we may want to change the method of the request
        based on certain specs or browser behavior.
        ÚHEADÚGET)rï   ÚQUERYÚPOST)rË   Ústatus_coder"   Ú	SEE_OTHERÚFOUNDÚMOVED_PERMANENTLY)rl   r˜   r™   rË   rL   rL   rM   rê   Ø  s   zBaseClient._redirect_methodc              
   C  s–   |j d }zt|ƒ}W n ty" } ztd|› d�|d�d‚d}~ww |jr1|js1|j|jjd�}|jr:|j 	|¡}|jj
rI|j
sI|j|jj
d�}|S )z<
        Return the URL for the redirect to follow.
        ÚLocationz Invalid URL in location header: Ú.©r˜   N)rH   )Úfragment)r†   r4   r   r   rI   rH   r®   r@   rÙ   Újoinrú   )rl   r˜   r™   rA   r@   ÚexcrL   rL   rM   rë   ñ  s   
€ÿzBaseClient._redirect_urlc                 C  sz   t |jƒ}|j|jjkr t|j|ƒs| dd¡ |j d¡|d< ||jkr5|dkr5| dd¡ | dd¡ | dd¡ |S )	zR
        Return the headers that should be used for the redirect request.
        ÚAuthorizationNrÀ   ÚHostrð   zContent-LengthzTransfer-EncodingÚCookie)	r   r†   rG   r@   rN   ÚpopÚnetlocÚdecoderË   )rl   r˜   r@   rË   r†   rL   rL   rM   rì     s   
zBaseClient._redirect_headersú'SyncByteStream | AsyncByteStream | Nonec                 C  s   ||j kr|dkrdS |jS )zO
        Return the body that should be used for the redirect request.
        rð   N)rË   ra   )rl   r˜   rË   rL   rL   rM   rí   '  s   zBaseClient._redirect_streamc                 C  sL   d|j vr$t| jtƒr| jnt| jƒ}tdi |j ¤d| ¡ i¤Ž|_ d S d S )Nrˆ   rL   )rÊ   r}   rˆ   rO   r   rÖ   r×   )rl   r˜   rˆ   rL   rL   rM   Ú_set_timeout0  s   
"þzBaseClient._set_timeout)r„   r�   r…   r�   r†   r‘   r‡   r’   rˆ   r3   r‰   rC   rŠ   r“   r‹   r”   rŒ   r•   r�   rC   rŽ   r–   rB   rd   )rB   rC   )r@   r4   rB   r4   )r°   r±   r²   rC   rB   r³   )rB   r   )rˆ   r3   rB   rd   )rB   r»   )r‹   r»   rB   rd   )rB   r¼   )r„   r(   rB   rd   )rB   r4   )r@   r•   rB   rd   )rB   r   )r†   r+   rB   rd   )rB   r   )r‡   r*   rB   rd   )rB   r5   )r…   r-   rB   rd   )rË   r·   r@   r•   rÆ   rÌ   rÇ   rÍ   rÈ   rÎ   rÉ   rÏ   r…   r�   r†   r‘   r‡   r’   rˆ   rÐ   rÊ   rÑ   rB   r   )r@   r•   rB   r4   rf   )r‡   r’   rB   r’   )r†   r‘   rB   r‘   )r…   r�   rB   r�   )r„   r�   rB   r¼   )r˜   r   r„   rè   rB   r
   )r˜   r   r™   r    rB   r   )r˜   r   r™   r    rB   r·   )r˜   r   r™   r    rB   r4   )r˜   r   r@   r4   rË   r·   rB   r   )r˜   r   rË   r·   rB   r  )r˜   r   rB   rd   )!rP   rQ   rR   r   r   rm   Úpropertyr§   r�   rš   r¸   rˆ   Úsetterr‹   r„   rŒ   r†   r‡   r…   r:   rØ   rÒ   rÔ   rÓ   rÕ   rœ   ré   rî   rê   rë   rì   rí   r  rL   rL   rL   rM   r€   ³   sŒ    ó"

	
ó
/	

ý




	r€   c                      s‚  e Zd ZdZdddddddddddedeedddddœd�‡ fd-d.„Zdddddedfd‘d0d1„Zdddddefd’d3d4„Z	d“d7d8„Z
dddddddeeedd9œd”dJdK„Zedddddddeeedd9œd•dMdN„ƒZedOdddddddeeededPœd–dTdU„ƒZeeeeeddddeeeddVœd—d_d`„ƒZdeedaœd˜dedf„Zd™djdk„Zdšdldm„Zd›dndo„Zdddeeeddpœdœdqdr„Zdddeeeddpœd�dtdu„Zdddeeeddpœd�dvdw„Zdddddddeeedd9œdždxdy„Zdddddddeeedd9œdždzd{„Zdddddddeeedd9œdžd|d}„Zdddeeeddpœd�d~d„Z dddddddeeedd9œdžd€d�„Z!dŸd‚dƒ„Z"d d†d‡„Z#			d¡d¢dŽd�„Z$‡  Z%S )£r<   a  
    An HTTP client, with connection pooling, HTTP/2, redirects, cookie persistence, etc.

    It can be shared between threads.

    Usage:

    ```python
    >>> client = httpx2.Client()
    >>> response = client.get('https://example.org')
    ```

    **Parameters:**

    * **auth** - *(optional)* An authentication class to use when sending
    requests.
    * **params** - *(optional)* Query parameters to include in request URLs, as
    a string, dictionary, or sequence of two-tuples.
    * **headers** - *(optional)* Dictionary of HTTP headers to include when
    sending requests.
    * **cookies** - *(optional)* Dictionary of Cookie items to include when
    sending requests.
    * **verify** - *(optional)* Either `True` to use an SSL context with the
    default CA bundle, `False` to disable verification, or an instance of
    `ssl.SSLContext` to use a custom context.
    * **http2** - *(optional)* A boolean indicating if HTTP/2 support should be
    enabled. Defaults to `False`.
    * **proxy** - *(optional)* A proxy URL where all the traffic should be routed.
    * **mounts** - *(optional)* A dictionary mapping URL patterns to transports,
    used to route requests through specific transports based on the URL.
    * **timeout** - *(optional)* The timeout configuration to use when sending
    requests.
    * **limits** - *(optional)* The limits configuration to use.
    * **max_redirects** - *(optional)* The maximum number of redirect responses
    that should be followed.
    * **base_url** - *(optional)* A URL to use as the base when building
    request URLs.
    * **transport** - *(optional)* A transport class to use for sending requests
    over the network.
    * **trust_env** - *(optional)* Enables or disables usage of environment
    variables for configuration.
    * **default_encoding** - *(optional)* The default encoding to use for decoding
    response text, if no charset information is included in a response Content-Type
    header. Set to a callable for automatic character set detection. Default: "utf-8".
    NTFr�   r‚   )r„   r…   r†   r‡   ÚverifyÚcertr�   Úhttp1Úhttp2r°   Úmountsrˆ   r‰   ÚlimitsrŠ   r‹   rŒ   Ú	transportrŽ   r„   r�   r…   r�   r†   r‘   r‡   r’   r  ússl.SSLContext | str | boolr  úCertTypes | Noner�   rC   r	  r
  r°   r±   r  ú0None | typing.Mapping[str, BaseTransport | None]rˆ   r3   r‰   r  r   rŠ   r“   r‹   r”   rŒ   r•   r  úBaseTransport | NonerŽ   r–   rB   rd   c                  sÜ   t ƒ j|||||||||ˆ|d� ˆr&zdd l}W n ty%   tdƒd ‚w ˆo+|d u }ˆ |
|¡}ˆjˆˆ ˆˆˆˆ|d�ˆ_‡ ‡‡‡‡‡‡fdd„| ¡ D ƒˆ_|d urbˆj 	dd„ | ¡ D ƒ¡ t
tˆj ¡ ƒƒˆ_d S )Nrƒ   r   úuUsing http2=True, but the 'h2' package is not installed. Make sure to install httpx using `pip install httpx[http2]`.©r  r  r�   r	  r
  r  r  c                   ó:   i | ]\}}t |ƒ|d u rd nˆj|ˆˆ ˆˆˆˆd�“qS ©N)r  r  r�   r	  r
  r  ©r6   Ú_init_proxy_transport©rV   rW   r°   ©r  r	  r
  r  rl   r�   r  rL   rM   rµ   Ÿ  ó    õÿùýz#Client.__init__.<locals>.<dictcomp>c                 S  ó   i | ]	\}}t |ƒ|“qS rL   ©r6   ©rV   rW   r  rL   rL   rM   rµ   ®  ó    ©Úsuperrm   Úh2ÚImportErrorr¸   Ú_init_transportÚ
_transportr¶   Ú_mountsrÄ   rÖ   Úsorted)rl   r„   r…   r†   r‡   r  r  r�   r	  r
  r°   r  rˆ   r‰   r  rŠ   r‹   rŒ   r  rŽ   r!  r²   Ú	proxy_map©Ú	__class__r  rM   rm   e  sP   õÿýÿù	ôzClient.__init__r&   c                 C  ó    |d ur|S t ||||||d�S r  ©r$   ©rl   r  r  r�   r	  r
  r  r  rL   rL   rM   r#  ²  ó   
úzClient._init_transportr   c              	   C  ó   t |||||||d�S ©N)r  r  r�   r	  r
  r  r°   r+  ©rl   r°   r  r  r�   r	  r
  r  rL   rL   rM   r  È  ó   
ùzClient._init_proxy_transportr@   r4   c                 C  ó>   | j  ¡ D ]\}}| |¡r|du r| j  S |  S q| jS ©z›
        Returns the transport instance that should be used for a given URL.
        This will either be the standard connection pool, or a proxy.
        N©r%  r¶   Úmatchesr$  ©rl   r@   Úpatternr  rL   rL   rM   Ú_transport_for_urlÜ  ó
   
ÿzClient._transport_for_url©rÆ   rÇ   rÈ   rÉ   r…   r†   r‡   r„   r‰   rˆ   rÊ   rË   r·   rÆ   rÌ   rÇ   rÍ   rÈ   rÎ   rÉ   rÏ   rè   úbool | UseClientDefaultrÐ   rÊ   rÑ   r    c                C  sL   |	durd}t j|tdd� | j|||||||||	||d�}| j||
|d�S )aª  
        Build and send a request.

        Equivalent to:

        ```python
        request = client.build_request(...)
        response = client.send(request, ...)
        ```

        See `Client.build_request()`, `Client.send()` and
        [Merging of configuration][0] for how the various parameters
        are merged with client-level configuration.

        [0]: advanced/clients.md#merging-of-configuration
        Nú®Setting per-request cookies=<...> is being deprecated, because the expected behaviour on cookie persistence is ambiguous. Set cookies directly on the client instance instead.rZ   ©Ú
stacklevel©rË   r@   rÆ   rÇ   rÈ   rÉ   r…   r†   r‡   rˆ   rÊ   ©r„   r‰   ©ÚwarningsÚwarnÚDeprecationWarningrØ   Úsend©rl   rË   r@   rÆ   rÇ   rÈ   rÉ   r…   r†   r‡   r„   r‰   rˆ   rÊ   Úmessager˜   rL   rL   rM   r˜   ç  s$   !ÿõzClient.requestúGenerator[Response]c                c  sT   � | j |||||||||	||d�}| j||
|dd�}z
|V  W | ¡  dS | ¡  w ©a  
        Alternative to `httpx2.request()` that streams the response body
        instead of loading it into memory at once.

        **Parameters**: See `httpx2.request`.

        See also: [Streaming Responses][0]

        [0]: quickstart.md#streaming-responses
        r?  T)r˜   r„   r‰   ra   N)rØ   rE  rx   ©rl   rË   r@   rÆ   rÇ   rÈ   rÉ   r…   r†   r‡   r„   r‰   rˆ   rÊ   r˜   r™   rL   rL   rM   ra     s.   €õüzClient.streamrð   ©rË   rÆ   rÇ   rÈ   rÉ   r…   r†   r‡   r„   r‰   rˆ   rÊ   Úmax_event_sizerL  ú
int | NoneúGenerator[EventSource]c                c  sh   � | j |||||||dddœt|ƒB |	|
|||d��}t||d�V  W d  ƒ dS 1 s-w   Y  dS )úÎ
        Connect to a server-sent events endpoint and yield an `EventSource`.

        Iterating the `EventSource` yields `ServerSentEvent` instances.

        **Parameters**: See `httpx2.request`.
        útext/event-streamúno-store©ÚAcceptzCache-Controlr:  ©rL  N©ra   r   r!   ©rl   r@   rË   rÆ   rÇ   rÈ   rÉ   r…   r†   r‡   r„   r‰   rˆ   rÊ   rL  r™   rL   rL   rM   ÚsseS  s&   €ó"ñz
Client.sse©Úmax_message_size_bytesÚ
queue_sizeÚkeepalive_ping_interval_secondsÚkeepalive_ping_timeout_secondsÚsubprotocolsr…   r†   r‡   r„   r‰   rˆ   rÊ   rY  rZ  r[  úfloat | Noner\  r]  úlist[str] | NoneúGenerator[WebSocketSession]c                c  s~   � zddl m} W n ty   tdƒ‚w |t|ƒ| ||||||||	|
|||d��}|V  W d  ƒ dS 1 s8w   Y  dS )az  
        Open a WebSocket session, using this client's configuration.

        The session is closed automatically when exiting the context manager.

        ```python
        with httpx2.Client() as client:
            with client.websocket("ws://localhost:8000/ws") as ws:
                ws.send_text("Hello!")
                message = ws.receive_text()
        ```
        r   )Ú
connect_wsú[WebSocket support requires the `wsproto` package. Install it with `pip install httpx2[ws]`.rX  N)Úwebsockets._apira  r"  r·   )rl   r@   rY  rZ  r[  r\  r]  r…   r†   r‡   r„   r‰   rˆ   rÊ   ra  ÚsessionrL   rL   rM   Ú	websocket~  s6   €ÿÿò"ðzClient.websocket©ra   r„   r‰   r˜   r   ra   c             
   C  s�   | j tjkr
tdƒ‚tj| _ t|tƒr| jn|}|  |¡ |  	||¡}| j
|||g d�}z	|s3| ¡  |W S  tyG } z| ¡  |‚d}~ww )a�  
        Send a request.

        The request is sent as-is, unmodified.

        Typically you'll want to build one with `Client.build_request()`
        so that any client-level configuration is merged into the request,
        but passing an explicit `httpx2.Request()` is supported as well.

        See also: [Request instances][0]

        [0]: advanced/clients.md#request-instances
        ú5Cannot send a request, as the client has been closed.©r„   r‰   ÚhistoryN)r¦   rY   r^   ÚRuntimeErrorr]   r}   rO   r‰   r  ré   Ú_send_handling_authÚreadÚBaseExceptionrx   ©rl   r˜   ra   r„   r‰   r™   rü   rL   rL   rM   rE  µ  s*   
ü€þzClient.sendr
   ri  úlist[Response]c           	   
   C  s®   |  |¡}zLt|ƒ}	 | j|||d�}z+z| |¡}W n ty,   | Y W W | ¡  S w t|ƒ|_| ¡  |}| 	|¡ W n t
yP } z| ¡  |‚d }~ww q| ¡  w ©NT)r‰   ri  )Úsync_auth_flowÚnextÚ_send_handling_redirectsrE  ÚStopIterationrx   r¡   ri  rl  Úappendrm  ©	rl   r˜   r„   r‰   ri  Ú	auth_flowr™   Únext_requestrü   rL   rL   rM   rk  ä  s6   
ý

ô
€þï
zClient._send_handling_authc              
   C  sÈ   	 t |ƒ| jkrtd|d�‚| jd D ]}||ƒ q|  |¡}z1| jd D ]}||ƒ q%t|ƒ|_|js7|W S |  ||¡}||g }|rI| 	¡  n||_
|W S W n tyb } z| ¡  |‚d }~ww q©NTz#Exceeded maximum allowed redirects.rù   r˜   r™   )ÚlenrŠ   r   r£   Ú_send_single_requestr¡   ri  Úhas_redirect_locationrî   rl  rx  rm  rx   ©rl   r˜   r‰   ri  Úhookr™   rü   rL   rL   rM   rs    s2   





ý€þçzClient._send_handling_redirectsc                 C  s¸   |   |j¡}t ¡ }t|jtƒstdƒ‚t|d�� | 	|¡}W d  ƒ n1 s)w   Y  t|jtƒs6J ‚||_
t|j|d�|_| j |¡ | j|_t d|j|j|j|j|j¡ |S )úL
        Sends a single request, without handling any redirections.
        z?Attempted to send an async request with a sync Client instance.rù   N©rb   úHTTP Request: %s %s "%s %d %s")r8  r@   rv   rw   r}   ra   r2   rj  r   Úhandle_requestr˜   r`   r‡   Úextract_cookiesr¥   rŽ   ÚloggerÚinforË   Úhttp_versionró   Úreason_phrase©rl   r˜   r  rb   r™   rL   rL   rM   r{  )  s*   ÿú	zClient._send_single_request©r…   r†   r‡   r„   r‰   rˆ   rÊ   c          	      C  ó   | j d||||||||d�	S )úV
        Send a `GET` request.

        **Parameters**: See `httpx2.request`.
        rð   r‰  rù   ©	rl   r@   r…   r†   r‡   r„   r‰   rˆ   rÊ   rL   rL   rM   r¢   H  ó   ÷z
Client.getúAuthTypes | UseClientDefaultc          	      C  rŠ  )ú[
        Send an `OPTIONS` request.

        **Parameters**: See `httpx2.request`.
        ÚOPTIONSr‰  rù   rŒ  rL   rL   rM   Úoptionse  r�  zClient.optionsc          	      C  rŠ  )úW
        Send a `HEAD` request.

        **Parameters**: See `httpx2.request`.
        rï   r‰  rù   rŒ  rL   rL   rM   Úhead‚  r�  zClient.headc                C  ó$   | j d|||||||||	|
||d�S )úW
        Send a `POST` request.

        **Parameters**: See `httpx2.request`.
        rò   r:  rù   ©rl   r@   rÆ   rÇ   rÈ   rÉ   r…   r†   r‡   r„   r‰   rˆ   rÊ   rL   rL   rM   ÚpostŸ  ó   ózClient.postc                C  r”  )úV
        Send a `PUT` request.

        **Parameters**: See `httpx2.request`.
        ÚPUTr:  rù   r–  rL   rL   rM   ÚputÄ  r˜  z
Client.putc                C  r”  )úX
        Send a `PATCH` request.

        **Parameters**: See `httpx2.request`.
        ÚPATCHr:  rù   r–  rL   rL   rM   Úpatché  r˜  zClient.patchc          	      C  rŠ  )úY
        Send a `DELETE` request.

        **Parameters**: See `httpx2.request`.
        ÚDELETEr‰  rù   rŒ  rL   rL   rM   Údelete  r�  zClient.deletec                C  r”  )úX
        Send a `QUERY` request.

        **Parameters**: See `httpx2.request`.
        rñ   r:  rù   r–  rL   rL   rM   Úquery+  r˜  zClient.queryc                 C  sF   | j tjkrtj| _ | j ¡  | j ¡ D ]}|dur| ¡  qdS dS ©z.
        Close transport and proxies.
        N)r¦   rY   r^   r$  rx   r%  Úvalues)rl   r  rL   rL   rM   rx   P  s   
€úzClient.closerl   r=   c                 C  s`   | j tjkrtjdtjdi| j  }t|ƒ‚tj| _ | j ¡  | j 	¡ D ]
}|d ur-| ¡  q#| S ©Nz-Cannot open a client instance more than once.z9Cannot reopen a client instance, once it has been closed.)
r¦   rY   r\   r]   r^   rj  r$  Ú	__enter__r%  r¥  )rl   Úmsgr  rL   rL   rM   r§  \  s   þý
€zClient.__enter__Úexc_typeútype[BaseException] | NoneÚ	exc_valueúBaseException | NoneÚ	tracebackúTracebackType | Nonec                 C  sB   t j| _| j |||¡ | j ¡ D ]}|d ur| |||¡ qd S rf   )rY   r^   r¦   r$  Ú__exit__r%  r¥  )rl   r©  r«  r­  r  rL   rL   rM   r¯  l  s   €þzClient.__exit__)(r„   r�   r…   r�   r†   r‘   r‡   r’   r  r  r  r  r�   rC   r	  rC   r
  rC   r°   r±   r  r  rˆ   r3   r‰   rC   r  r   rŠ   r“   r‹   r”   rŒ   r•   r  r  rŽ   r–   rB   rd   )r  r  r  r  r�   rC   r	  rC   r
  rC   r  r   r  r  rB   r&   )r°   r   r  r  r  r  r�   rC   r	  rC   r
  rC   r  r   rB   r&   )r@   r4   rB   r&   ©rË   r·   r@   r•   rÆ   rÌ   rÇ   rÍ   rÈ   rÎ   rÉ   rÏ   r…   r�   r†   r‘   r‡   r’   r„   rè   r‰   r;  rˆ   rÐ   rÊ   rÑ   rB   r    )rË   r·   r@   r•   rÆ   rÌ   rÇ   rÍ   rÈ   rÎ   rÉ   rÏ   r…   r�   r†   r‘   r‡   r’   r„   rè   r‰   r;  rˆ   rÐ   rÊ   rÑ   rB   rH  )r@   r•   rË   r·   rÆ   rÌ   rÇ   rÍ   rÈ   rÎ   rÉ   rÏ   r…   r�   r†   r‘   r‡   r’   r„   rè   r‰   r;  rˆ   rÐ   rÊ   rÑ   rL  rM  rB   rN  )r@   r•   rY  r“   rZ  r“   r[  r^  r\  r^  r]  r_  r…   r�   r†   r‘   r‡   r’   r„   rè   r‰   r;  rˆ   rÐ   rÊ   rÑ   rB   r`  ©
r˜   r   ra   rC   r„   rè   r‰   r;  rB   r    ©
r˜   r   r„   r
   r‰   rC   ri  ro  rB   r    ©r˜   r   r‰   rC   ri  ro  rB   r    ©r˜   r   rB   r    ©r@   r•   r…   r�   r†   r‘   r‡   r’   r„   rè   r‰   r;  rˆ   rÐ   rÊ   rÑ   rB   r    ©r@   r•   r…   r�   r†   r‘   r‡   r’   r„   rŽ  r‰   r;  rˆ   rÐ   rÊ   rÑ   rB   r    ©r@   r•   rÆ   rÌ   rÇ   rÍ   rÈ   rÎ   rÉ   rÏ   r…   r�   r†   r‘   r‡   r’   r„   rŽ  r‰   r;  rˆ   rÐ   rÊ   rÑ   rB   r    ry   )rl   r=   rB   r=   ©NNN©r©  rª  r«  r¬  r­  r®  rB   rd   )&rP   rQ   rR   rS   r   r   r   rm   r#  r  r8  r:   r˜   r   ra   r   rW  r   r   r   r   re  rE  rk  rs  r{  r¢   r‘  r“  r—  r›  rž  r¡  r£  rx   r§  r¯  Ú__classcell__rL   rL   r(  rM   r<   6  sr   1ëOøø
ñ8ñ3ð*ñ:ú
/
"
##ö!ö!ö!ò)ò)ò)ö!ò
%
üc                      s‚  e Zd ZdZddddddddddedeeddddddœd�‡ fd-d.„Zdddddedfd‘d0d1„Zdddddefd’d3d4„Z	d“d7d8„Z
dddddddeeedd9œd”dJdK„Zedddddddeeedd9œd•dMdN„ƒZedOdddddddeeededPœd–dTdU„ƒZeeeeeddddeeeddVœd—d_d`„ƒZdeedaœd˜dedf„Zd™djdk„Zdšdldm„Zd›dndo„Zdddeeeddpœdœdqdr„Zdddeeeddpœd�dtdu„Zdddeeeddpœd�dvdw„Zdddddddeeedd9œdždxdy„Zdddddddeeedd9œdždzd{„Zdddddddeeedd9œdžd|d}„Zdddeeeddpœd�d~d„Z dddddddeeedd9œdžd€d�„Z!dŸd‚dƒ„Z"d d†d‡„Z#			d¡d¢dŽd�„Z$‡  Z%S )£r;   a<  
    An asynchronous HTTP client, with connection pooling, HTTP/2, redirects,
    cookie persistence, etc.

    It can be shared between tasks.

    Usage:

    ```python
    >>> async with httpx2.AsyncClient() as client:
    >>>     response = await client.get('https://example.org')
    ```

    **Parameters:**

    * **auth** - *(optional)* An authentication class to use when sending
    requests.
    * **params** - *(optional)* Query parameters to include in request URLs, as
    a string, dictionary, or sequence of two-tuples.
    * **headers** - *(optional)* Dictionary of HTTP headers to include when
    sending requests.
    * **cookies** - *(optional)* Dictionary of Cookie items to include when
    sending requests.
    * **verify** - *(optional)* Either `True` to use an SSL context with the
    default CA bundle, `False` to disable verification, or an instance of
    `ssl.SSLContext` to use a custom context.
    * **http2** - *(optional)* A boolean indicating if HTTP/2 support should be
    enabled. Defaults to `False`.
    * **proxy** - *(optional)* A proxy URL where all the traffic should be routed.
    * **mounts** - *(optional)* A dictionary mapping URL patterns to transports,
    used to route requests through specific transports based on the URL.
    * **timeout** - *(optional)* The timeout configuration to use when sending
    requests.
    * **limits** - *(optional)* The limits configuration to use.
    * **max_redirects** - *(optional)* The maximum number of redirect responses
    that should be followed.
    * **base_url** - *(optional)* A URL to use as the base when building
    request URLs.
    * **transport** - *(optional)* A transport class to use for sending requests
    over the network.
    * **trust_env** - *(optional)* Enables or disables usage of environment
    variables for configuration.
    * **default_encoding** - *(optional)* The default encoding to use for decoding
    response text, if no charset information is included in a response Content-Type
    header. Set to a callable for automatic character set detection. Default: "utf-8".
    NTFr�   r‚   )r„   r…   r†   r‡   r  r  r	  r
  r°   r  rˆ   r‰   r  rŠ   r‹   rŒ   r  r�   rŽ   r„   r�   r…   r�   r†   r‘   r‡   r’   r  r  r  r  r	  rC   r
  r°   r±   r  ú5None | typing.Mapping[str, AsyncBaseTransport | None]rˆ   r3   r‰   r  r   rŠ   r“   r‹   r”   rŒ   r•   r  úAsyncBaseTransport | Noner�   rŽ   r–   rB   rd   c                  sÜ   t ƒ j|||||||||ˆ|d� ˆr&zdd l}W n ty%   tdƒd ‚w ˆo+|d u }ˆ |	|¡}ˆjˆˆ ˆˆˆˆ|d�ˆ_‡ ‡‡‡‡‡‡fdd„| ¡ D ƒˆ_|
d urbˆj 	dd„ |
 ¡ D ƒ¡ t
tˆj ¡ ƒƒˆ_d S )Nrƒ   r   r  r  c                   r  r  r  r  r  rL   rM   rµ   å  r  z(AsyncClient.__init__.<locals>.<dictcomp>c                 S  r  rL   r  r  rL   rL   rM   rµ   ô  r  r  )rl   r„   r…   r†   r‡   r  r  r	  r
  r°   r  rˆ   r‰   r  rŠ   r‹   rŒ   r  r�   rŽ   r!  r²   r'  r(  r  rM   rm   ª  sP   õÿýÿù
ôzAsyncClient.__init__r%   c                 C  r*  r  ©r#   r,  rL   rL   rM   r#  ÷  r-  zAsyncClient._init_transportr   c              	   C  r.  r/  r½  r0  rL   rL   rM   r    r1  z!AsyncClient._init_proxy_transportr@   r4   c                 C  r2  r3  r4  r6  rL   rL   rM   r8  !  r9  zAsyncClient._transport_for_urlr:  rË   r·   rÆ   rÌ   rÇ   rÍ   rÈ   rÎ   rÉ   rÏ   rè   r;  rÐ   rÊ   rÑ   r    c                Ã  sT   �|	durd}t j|tdd� | j|||||||||	||d�}| j||
|d�I dH S )aº  
        Build and send a request.

        Equivalent to:

        ```python
        request = client.build_request(...)
        response = await client.send(request, ...)
        ```

        See `AsyncClient.build_request()`, `AsyncClient.send()`
        and [Merging of configuration][0] for how the various parameters
        are merged with client-level configuration.

        [0]: advanced/clients.md#merging-of-configuration
        Nr<  rZ   r=  r?  r@  rA  rF  rL   rL   rM   r˜   ,  s&   €"ÿõzAsyncClient.requestúAsyncGenerator[Response]c                C sf   �| j |||||||||	||d�}| j||
|dd�I dH }z|V  W | ¡ I dH  dS | ¡ I dH  w rI  )rØ   rE  r~   rJ  rL   rL   rM   ra   e  s.   €õü"zAsyncClient.streamrð   rK  rL  rM  úAsyncGenerator[EventSource]c                C s|   �| j |||||||dddœt|ƒB |	|
|||d�4 I dH š}t||d�V  W d  ƒI dH  dS 1 I dH s7w   Y  dS )rO  rP  rQ  rR  r:  NrT  rU  rV  rL   rL   rM   rW  ™  s&   €ó.ñzAsyncClient.sserX  rY  rZ  r[  r^  r\  r]  r_  ú%AsyncGenerator[AsyncWebSocketSession]c                C s’   �zddl m} W n ty   tdƒ‚w |t|ƒ| ||||||||	|
|||d�4 I dH š}|V  W d  ƒI dH  dS 1 I dH sBw   Y  dS )a—  
        Open a WebSocket session, using this client's configuration.

        The session is closed automatically when exiting the context manager.

        ```python
        async with httpx2.AsyncClient() as client:
            async with client.websocket("ws://localhost:8000/ws") as ws:
                await ws.send_text("Hello!")
                message = await ws.receive_text()
        ```
        r   )Úaconnect_wsrb  rX  N)rc  rÁ  r"  r·   )rl   r@   rY  rZ  r[  r\  r]  r…   r†   r‡   r„   r‰   rˆ   rÊ   rÁ  rd  rL   rL   rM   re  Ä  s6   €ÿÿò.ðzAsyncClient.websocketrf  r˜   r   ra   c             
   Ã  s¤   �| j tjkrtdƒ‚tj| _ t|tƒr| jn|}|  |¡ |  	||¡}| j
|||g d�I dH }z|s:| ¡ I dH  |W S  tyQ } z	| ¡ I dH  |‚d}~ww )a’  
        Send a request.

        The request is sent as-is, unmodified.

        Typically you'll want to build one with `AsyncClient.build_request()`
        so that any client-level configuration is merged into the request,
        but passing an explicit `httpx2.Request()` is supported as well.

        See also: [Request instances][0]

        [0]: advanced/clients.md#request-instances
        rg  rh  N)r¦   rY   r^   rj  r]   r}   rO   r‰   r  ré   rk  Úareadrm  r~   rn  rL   rL   rM   rE  û  s,   €
ü€þzAsyncClient.sendr
   ri  ro  c           	   
   Ã  sÚ   �|  |¡}z^| ¡ I d H }	 | j|||d�I d H }z4z
| |¡I d H }W n ty9   | Y W W | ¡ I d H  S w t|ƒ|_| ¡ I d H  |}| 	|¡ W n t
yc } z	| ¡ I d H  |‚d }~ww q| ¡ I d H  w rp  )Úasync_auth_flowÚ	__anext__rs  ÚasendÚStopAsyncIterationr~   r¡   ri  rÂ  ru  rm  rv  rL   rL   rM   rk  *  s8   €
ý
ô
€þïzAsyncClient._send_handling_authc              
   Ã  sè   �	 t |ƒ| jkrtd|d�‚| jd D ]	}||ƒI d H  q|  |¡I d H }z7| jd D ]	}||ƒI d H  q,t|ƒ|_|jsA|W S |  ||¡}||g }|rV| 	¡ I d H  n||_
|W S W n tyr } z	| ¡ I d H  |‚d }~ww qry  )rz  rŠ   r   r£   r{  r¡   ri  r|  rî   rÂ  rx  rm  r~   r}  rL   rL   rM   rs  L  s4   €

ý€þæz$AsyncClient._send_handling_redirectsc                 Ã  sÀ   �|   |j¡}t ¡ }t|jtƒstdƒ‚t|d�� | 	|¡I dH }W d  ƒ n1 s-w   Y  t|jtƒs:J ‚||_
t|j|d�|_| j |¡ | j|_t d|j|j|j|j|j¡ |S )r  z>Attempted to send a sync request with an AsyncClient instance.rù   Nr€  r�  )r8  r@   rv   rw   r}   ra   r'   rj  r   Úhandle_async_requestr˜   rz   r‡   rƒ  r¥   rŽ   r„  r…  rË   r†  ró   r‡  rˆ  rL   rL   rM   r{  p  s,   €ÿú	z AsyncClient._send_single_requestr‰  c          	      Ã  ó$   �| j d||||||||d�	I dH S )r‹  rð   r‰  Nrù   rŒ  rL   rL   rM   r¢   Ž  ó   €÷zAsyncClient.getrŽ  c          	      Ã  rÈ  )r�  r�  r‰  Nrù   rŒ  rL   rL   rM   r‘  «  rÉ  zAsyncClient.optionsc          	      Ã  rÈ  )r’  rï   r‰  Nrù   rŒ  rL   rL   rM   r“  È  rÉ  zAsyncClient.headc                Ã  ó,   �| j d|||||||||	|
||d�I dH S )r•  rò   r:  Nrù   r–  rL   rL   rM   r—  å  ó    €ózAsyncClient.postc                Ã  rÊ  )r™  rš  r:  Nrù   r–  rL   rL   rM   r›  
  rË  zAsyncClient.putc                Ã  rÊ  )rœ  r�  r:  Nrù   r–  rL   rL   rM   rž  /  rË  zAsyncClient.patchc          	      Ã  rÈ  )rŸ  r   r‰  Nrù   rŒ  rL   rL   rM   r¡  T  rÉ  zAsyncClient.deletec                Ã  rÊ  )r¢  rñ   r:  Nrù   r–  rL   rL   rM   r£  q  rË  zAsyncClient.queryc                 Ã  sT   �| j tjkr&tj| _ | j ¡ I dH  | j ¡ D ]}|dur%| ¡ I dH  qdS dS r¤  )r¦   rY   r^   r$  r~   r%  r¥  )rl   r°   rL   rL   rM   r~   –  s   €€úzAsyncClient.acloserl   r?   c                 Ã  sn   �| j tjkrtjdtjdi| j  }t|ƒ‚tj| _ | j ¡ I d H  | j 	¡ D ]}|d ur4| ¡ I d H  q'| S r¦  )
r¦   rY   r\   r]   r^   rj  r$  Ú
__aenter__r%  r¥  )rl   r¨  r°   rL   rL   rM   rÌ  ¢  s   €þý€zAsyncClient.__aenter__r©  rª  r«  r¬  r­  r®  c                 Ã  sP   �t j| _| j |||¡I d H  | j ¡ D ]}|d ur%| |||¡I d H  qd S rf   )rY   r^   r¦   r$  Ú	__aexit__r%  r¥  )rl   r©  r«  r­  r°   rL   rL   rM   rÍ  ²  s   €€þzAsyncClient.__aexit__)(r„   r�   r…   r�   r†   r‘   r‡   r’   r  r  r  r  r	  rC   r
  rC   r°   r±   r  r»  rˆ   r3   r‰   rC   r  r   rŠ   r“   r‹   r”   rŒ   r•   r  r¼  r�   rC   rŽ   r–   rB   rd   )r  r  r  r  r�   rC   r	  rC   r
  rC   r  r   r  r¼  rB   r%   )r°   r   r  r  r  r  r�   rC   r	  rC   r
  rC   r  r   rB   r%   )r@   r4   rB   r%   r°  )rË   r·   r@   r•   rÆ   rÌ   rÇ   rÍ   rÈ   rÎ   rÉ   rÏ   r…   r�   r†   r‘   r‡   r’   r„   rè   r‰   r;  rˆ   rÐ   rÊ   rÑ   rB   r¾  )r@   r•   rË   r·   rÆ   rÌ   rÇ   rÍ   rÈ   rÎ   rÉ   rÏ   r…   r�   r†   r‘   r‡   r’   r„   rè   r‰   r;  rˆ   rÐ   rÊ   rÑ   rL  rM  rB   r¿  )r@   r•   rY  r“   rZ  r“   r[  r^  r\  r^  r]  r_  r…   r�   r†   r‘   r‡   r’   r„   rè   r‰   r;  rˆ   rÐ   rÊ   rÑ   rB   rÀ  r±  r²  r³  r´  rµ  r¶  r·  ry   )rl   r?   rB   r?   r¸  r¹  )&rP   rQ   rR   rS   r   r   r   rm   r#  r  r8  r:   r˜   r   ra   r   rW  r   r   r   r   re  rE  rk  rs  r{  r¢   r‘  r“  r—  r›  rž  r¡  r£  r~   rÌ  rÍ  rº  rL   rL   r(  rM   r;   z  sr   2ëOøø
ñ9ñ3ð*ñ:ú
/
"
$"ö!ö!ö!ò)ò)ò)ö!ò
%
ü)r@   r4   rA   r4   rB   rC   )gÚ
__future__r   rt   ÚenumÚloggingrv   ÚtypingrB  Úcollections.abcr   r   Ú
contextlibr   r   Útypesr   r	   r�   r
   r   r   Ú_configr   r   r   r   r   r   r   r   r   r   r   Ú	_decodersr   Ú_exceptionsr   r   r   r   Ú_modelsr   r   r   r    Ú_sser!   Ú_status_codesr"   Ú_transportsr#   r$   Ú_transports.baser%   r&   Ú_typesr'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   Ú_urlsr4   r5   Ú_utilsr6   r7   ÚTYPE_CHECKINGÚsslrc  r8   r9   Ú__all__ÚTypeVarr=   r?   rN   rO   r:   Ú	getLoggerr„  rÃ   rû   ÚkeysrÁ   ÚEnumrY   r`   rz   ÚCallableÚAnyÚ	EventHookr€   r<   r;   rL   rL   rL   rM   Ú<module>   sf    4<


         J