o
    ùT·jÊ9  ã                   @  s`  d dl mZ d dlZd dlmZ d dlmZ ddlmZ ddl	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mZmZmZmZmZ dd
lmZ ejrYd dlZddlm Z  g d¢Z!dddddddddeddddœdSd/d0„Z"edddddddddeddddœdTd2d3„ƒZ#dddddddedd4œ	dUd5d6„Z$dddddddedd4œ	dUd7d8„Z%dddddddedd4œ	dUd9d:„Z&dddddddddddedd;œdVd<d=„Z'dddddddddddedd;œdVd>d?„Z(dddddddddddedd;œdVd@dA„Z)ddddddedddBœ	dWdCdD„Z*dddddddddddedd;œdVdEdF„Z+eddddddedddeee
edGœdXdQdR„ƒZ,dS )Yé    )ÚannotationsN)Ú	Generator)Úcontextmanageré   )ÚClient)Ú'DEFAULT_KEEPALIVE_PING_INTERVAL_SECONDSÚ&DEFAULT_KEEPALIVE_PING_TIMEOUT_SECONDSÚDEFAULT_MAX_MESSAGE_SIZE_BYTESÚDEFAULT_QUEUE_SIZEÚDEFAULT_TIMEOUT_CONFIG)ÚResponse)	Ú	AuthTypesÚCookieTypesÚHeaderTypesÚ
ProxyTypesÚQueryParamTypesÚRequestContentÚRequestDataÚRequestFilesÚTimeoutTypes)ÚURL)ÚWebSocketSession)ÚdeleteÚgetÚheadÚoptionsÚpatchÚpostÚputÚqueryÚrequestÚstreamÚ	websocketFT)ÚparamsÚcontentÚdataÚfilesÚjsonÚheadersÚcookiesÚauthÚproxyÚtimeoutÚfollow_redirectsÚverifyÚ	trust_envÚmethodÚstrÚurlú	URL | strr#   úQueryParamTypes | Noner$   úRequestContent | Noner%   úRequestData | Noner&   úRequestFiles | Noner'   útyping.Any | Noner(   úHeaderTypes | Noner)   úCookieTypes | Noner*   úAuthTypes | Noner+   úProxyTypes | Noner,   r   r-   Úboolr.   ússl.SSLContext | str | boolr/   Úreturnr   c                C  sT   t ||
|||d��}|j| ||||||||	|d�
W  d  ƒ S 1 s#w   Y  dS )aÖ  Sends an HTTP request.

    Parameters:
        method: HTTP method for the new `Request` object: `GET`, `OPTIONS`, `HEAD`, `POST`, `PUT`, `PATCH`, `DELETE`,
            or `QUERY`.
        url: URL for the new `Request` object.
        params: *(optional)* Query parameters to include in the URL, as a string, dictionary, or sequence of two-tuples.
        content: *(optional)* Binary content to include in the body of the request, as bytes or a byte iterator.
        data: *(optional)* Form data to include in the body of the request, as a dictionary.
        files: *(optional)* A dictionary of upload files to include in the body of the request.
        json: *(optional)* A JSON serializable object to include in the body of the request.
        headers: *(optional)* Dictionary of HTTP headers to include in the request.
        cookies: *(optional)* Dictionary of Cookie items to include in the request.
        auth: *(optional)* An authentication class to use when sending the request.
        proxy: *(optional)* A proxy URL where all the traffic should be routed.
        timeout: *(optional)* The timeout configuration to use when sending the request.
        follow_redirects: *(optional)* Enables or disables HTTP redirects.
        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.
        trust_env: *(optional)* Enables or disables usage of environment variables for configuration.

    Returns:
        The `Response` object.

    Usage:

    ```
    >>> import httpx2
    >>> response = httpx2.request('GET', 'https://httpbin.org/get')
    >>> response
    <Response [200 OK]>
    ```
    ©r)   r+   r.   r,   r/   ©
r0   r2   r$   r%   r&   r'   r#   r(   r*   r-   N)r   r    )r0   r2   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   Úclient© rC   úN/home/dinkstrade/pdmp-scanner/venv/lib/python3.10/site-packages/httpx2/_api.pyr    2   s*   3ûö$ùr    úGenerator[Response]c                c  sŽ   � t ||
|||d��3}|j| ||||||||	|d�
�}|V  W d  ƒ n1 s(w   Y  W d  ƒ dS W d  ƒ dS 1 s@w   Y  dS )zø
    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@   rA   N)r   r!   )r0   r2   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   rB   ÚresponserC   rC   rD   r!   z   s6   €ûöôù"ùr!   ©	r#   r(   r)   r*   r+   r-   r.   r,   r/   c       	   
      C  ó   t d| |||||||||	d�S )zì
    Sends a `GET` request.

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

    Note that the `data`, `files`, `json` and `content` parameters are not available
    on this function, as `GET` requests should not include a request body.
    ÚGETrG   ©r    ©
r2   r#   r(   r)   r*   r+   r-   r.   r,   r/   rC   rC   rD   r   ­   ó   õr   c       	   
      C  rH   )zõ
    Sends an `OPTIONS` request.

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

    Note that the `data`, `files`, `json` and `content` parameters are not available
    on this function, as `OPTIONS` requests should not include a request body.
    ÚOPTIONSrG   rJ   rK   rC   rC   rD   r   Ñ   rL   r   c       	   
      C  rH   )zî
    Sends a `HEAD` request.

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

    Note that the `data`, `files`, `json` and `content` parameters are not available
    on this function, as `HEAD` requests should not include a request body.
    ÚHEADrG   rJ   rK   rC   rC   rD   r   õ   rL   r   ©r$   r%   r&   r'   r#   r(   r)   r*   r+   r-   r.   r,   r/   c                C  ó&   t d| |||||||||	|
|||d�S )zL
    Sends a `POST` request.

    **Parameters**: See `httpx2.request`.
    ÚPOSTrO   rJ   ©r2   r$   r%   r&   r'   r#   r(   r)   r*   r+   r-   r.   r,   r/   rC   rC   rD   r     ó"   ñr   c                C  rP   )zK
    Sends a `PUT` request.

    **Parameters**: See `httpx2.request`.
    ÚPUTrO   rJ   rR   rC   rC   rD   r   B  rS   r   c                C  rP   )zM
    Sends a `PATCH` request.

    **Parameters**: See `httpx2.request`.
    ÚPATCHrO   rJ   rR   rC   rC   rD   r   k  rS   r   )	r#   r(   r)   r*   r+   r-   r,   r.   r/   c       	   
      C  s   t d| |||||||||	d�S )zò
    Sends a `DELETE` request.

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

    Note that the `data`, `files`, `json` and `content` parameters are not available
    on this function, as `DELETE` requests should not include a request body.
    ÚDELETErG   rJ   )
r2   r#   r(   r)   r*   r+   r-   r,   r.   r/   rC   rC   rD   r   ”  rL   r   c                C  rP   )zM
    Sends a `QUERY` request.

    **Parameters**: See `httpx2.request`.
    ÚQUERYrO   rJ   rR   rC   rC   rD   r   ¸  rS   r   )r#   r(   r)   r*   r+   r-   r,   r.   r/   ÚsubprotocolsÚmax_message_size_bytesÚ
queue_sizeÚkeepalive_ping_interval_secondsÚkeepalive_ping_timeout_secondsrX   úlist[str] | NonerY   ÚintrZ   r[   úfloat | Noner\   úGenerator[WebSocketSession]c                c  sŽ   � t |||||	d��3}|j| |||||
||||d�
�}|V  W d  ƒ n1 s(w   Y  W d  ƒ dS W d  ƒ dS 1 s@w   Y  dS )aL  
    Open a WebSocket session.

    The session is closed automatically when exiting the context manager.

    ```python
    with httpx2.websocket("ws://localhost:8000/ws") as ws:
        ws.send_text("Hello!")
        message = ws.receive_text()
    ```

    **Parameters**: See `httpx2.request` and `httpx2.Client.websocket`.
    r@   )	r#   r(   r*   r-   rX   rY   rZ   r[   r\   N)r   r"   )r2   r#   r(   r)   r*   r+   r-   r,   r.   r/   rX   rY   rZ   r[   r\   rB   ÚsessionrC   rC   rD   r"   á  s6   € ûöôù"ùr"   ) r0   r1   r2   r3   r#   r4   r$   r5   r%   r6   r&   r7   r'   r8   r(   r9   r)   r:   r*   r;   r+   r<   r,   r   r-   r=   r.   r>   r/   r=   r?   r   ) r0   r1   r2   r3   r#   r4   r$   r5   r%   r6   r&   r7   r'   r8   r(   r9   r)   r:   r*   r;   r+   r<   r,   r   r-   r=   r.   r>   r/   r=   r?   rE   )r2   r3   r#   r4   r(   r9   r)   r:   r*   r;   r+   r<   r-   r=   r.   r>   r,   r   r/   r=   r?   r   )r2   r3   r$   r5   r%   r6   r&   r7   r'   r8   r#   r4   r(   r9   r)   r:   r*   r;   r+   r<   r-   r=   r.   r>   r,   r   r/   r=   r?   r   )r2   r3   r#   r4   r(   r9   r)   r:   r*   r;   r+   r<   r-   r=   r,   r   r.   r>   r/   r=   r?   r   ) r2   r3   r#   r4   r(   r9   r)   r:   r*   r;   r+   r<   r-   r=   r,   r   r.   r>   r/   r=   rX   r]   rY   r^   rZ   r^   r[   r_   r\   r_   r?   r`   )-Ú
__future__r   ÚtypingÚcollections.abcr   Ú
contextlibr   Ú_clientr   Ú_configr   r   r	   r
   r   Ú_modelsr   Ú_typesr   r   r   r   r   r   r   r   r   Ú_urlsr   ÚTYPE_CHECKINGÚsslÚwebsockets._apir   Ú__all__r    r!   r   r   r   r   r   r   r   r   r"   rC   rC   rC   rD   Ú<module>   s4   ,ðHð5õ'õ'õ'ñ,ñ,ñ,õ'ñ)ð