o
    í6Wjß-  ã                   @  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
 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rEd dlZg d
¢ZdddddddddeddddœdCd-d.„ZedddddddddeddddœdDd0d1„ƒZdddddddedd2œ	dEd3d4„Zdddddddedd2œ	dEd5d6„Zdddddddedd2œ	dEd7d8„Zdddddddddddedd9œdFd:d;„Zdddddddddddedd9œdFd<d=„Z dddddddddddedd9œdFd>d?„Z!ddddddeddd@œ	dGdAdB„Z"dS )Hé    )ÚannotationsN)Úcontextmanageré   )ÚClient)ÚDEFAULT_TIMEOUT_CONFIG)ÚResponse)	Ú	AuthTypesÚCookieTypesÚHeaderTypesÚ
ProxyTypesÚQueryParamTypesÚRequestContentÚRequestDataÚRequestFilesÚTimeoutTypes)ÚURL)	ÚdeleteÚgetÚheadÚoptionsÚpatchÚpostÚputÚrequestÚstreamFT)Ú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`, or `DELETE`.
    * **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:** `Response`

    Usage:

    ```
    >>> import httpx
    >>> response = httpx.request('GET', 'https://httpbin.org/get')
    >>> response
    <Response [200 OK]>
    ```
    ©r!   r#   r&   r$   r'   ©
r(   r*   r   r   r   r   r   r    r"   r%   N)r   r   )r(   r*   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   Úclient© r;   úY/home/esfera/Documents/content_generation/venv/lib/python3.10/site-packages/httpx/_api.pyr   '   s*   ?ûö$ùr   útyping.Iterator[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 `httpx.request()` that streams the response body
    instead of loading it into memory at once.

    **Parameters**: See `httpx.request`.

    See also: [Streaming Responses][0]

    [0]: /quickstart#streaming-responses
    r8   r9   N)r   r   )r(   r*   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r:   Úresponser;   r;   r<   r   {   s6   €ûöôù"ùr   ©	r   r    r!   r"   r#   r%   r&   r$   r'   c       	   
      C  ó   t d| |||||||||	d�S )zë
    Sends a `GET` request.

    **Parameters**: See `httpx.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.
    ÚGETr?   ©r   ©
r*   r   r    r!   r"   r#   r%   r&   r$   r'   r;   r;   r<   r   ®   ó   õr   c       	   
      C  r@   )zô
    Sends an `OPTIONS` request.

    **Parameters**: See `httpx.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.
    ÚOPTIONSr?   rB   rC   r;   r;   r<   r   Ò   rD   r   c       	   
      C  r@   )zí
    Sends a `HEAD` request.

    **Parameters**: See `httpx.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.
    ÚHEADr?   rB   rC   r;   r;   r<   r   ö   rD   r   ©r   r   r   r   r   r    r!   r"   r#   r%   r&   r$   r'   c                C  ó&   t d| |||||||||	|
|||d�S )zK
    Sends a `POST` request.

    **Parameters**: See `httpx.request`.
    ÚPOSTrG   rB   ©r*   r   r   r   r   r   r    r!   r"   r#   r%   r&   r$   r'   r;   r;   r<   r     ó"   ñr   c                C  rH   )zJ
    Sends a `PUT` request.

    **Parameters**: See `httpx.request`.
    ÚPUTrG   rB   rJ   r;   r;   r<   r   C  rK   r   c                C  rH   )zL
    Sends a `PATCH` request.

    **Parameters**: See `httpx.request`.
    ÚPATCHrG   rB   rJ   r;   r;   r<   r   l  rK   r   )	r   r    r!   r"   r#   r%   r$   r&   r'   c       	   
      C  s   t d| |||||||||	d�S )zñ
    Sends a `DELETE` request.

    **Parameters**: See `httpx.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.
    ÚDELETEr?   rB   )
r*   r   r    r!   r"   r#   r%   r$   r&   r'   r;   r;   r<   r   •  rD   r   ) r(   r)   r*   r+   r   r,   r   r-   r   r.   r   r/   r   r0   r    r1   r!   r2   r"   r3   r#   r4   r$   r   r%   r5   r&   r6   r'   r5   r7   r   ) r(   r)   r*   r+   r   r,   r   r-   r   r.   r   r/   r   r0   r    r1   r!   r2   r"   r3   r#   r4   r$   r   r%   r5   r&   r6   r'   r5   r7   r=   )r*   r+   r   r,   r    r1   r!   r2   r"   r3   r#   r4   r%   r5   r&   r6   r$   r   r'   r5   r7   r   )r*   r+   r   r-   r   r.   r   r/   r   r0   r   r,   r    r1   r!   r2   r"   r3   r#   r4   r%   r5   r&   r6   r$   r   r'   r5   r7   r   )r*   r+   r   r,   r    r1   r!   r2   r"   r3   r#   r4   r%   r5   r$   r   r&   r6   r'   r5   r7   r   )#Ú
__future__r   ÚtypingÚ
contextlibr   Ú_clientr   Ú_configr   Ú_modelsr   Ú_typesr   r	   r
   r   r   r   r   r   r   Ú_urlsr   ÚTYPE_CHECKINGÚsslÚ__all__r   r   r   r   r   r   r   r   r   r;   r;   r;   r<   Ú<module>   sô    ,ðTð5õ'õ'õ'ñ,ñ,ñ,õ