Ë
    ïñþiZ  ã            	       ó¾   — d Z ddlmZmZ ddlZg d¢ZdZdZ G d„ de«      Z	 	 	 dd	e	e
e
f   dz  d
ej                  dz  dej                  dz  dej                  fd„Zy)z@Utilities for creating standardized httpx AsyncClient instances.é    )ÚAnyÚProtocolN)Úcreate_mcp_http_clientÚMCP_DEFAULT_TIMEOUTÚMCP_DEFAULT_SSE_READ_TIMEOUTg      >@g     Àr@c            	       ó„   — e Zd Z	 	 	 ddeeef   dz  dej                  dz  dej                  dz  dej                  fd„Z	y)ÚMcpHttpClientFactoryNÚheadersÚtimeoutÚauthÚreturnc                  ó   — y )N© )Úselfr
   r   r   s       úW/root/aria/mcps/aria-brain/venv/lib/python3.12/site-packages/mcp/shared/_httpx_utils.pyÚ__call__zMcpHttpClientFactory.__call__   s   € ð
  ó    ©NNN)
Ú__name__Ú
__module__Ú__qualname__ÚdictÚstrÚhttpxÚTimeoutÚAuthÚAsyncClientr   r   r   r   r	   r	      s]   „ ð *.Ø(,Ø"&ñ	 à�c˜3�h‘ $Ñ&ð ð —‘ Ñ%ð ð �j‰j˜4Ñð	 ð
 
×	Ñ	ô r   r	   r
   r   r   r   c                 ó¤   — ddi}|€#t        j                  t        t        ¬«      |d<   n||d<   | �| |d<   |�||d<   t        j                  di |¤ŽS )a	  Create a standardized httpx AsyncClient with MCP defaults.

    This function provides common defaults used throughout the MCP codebase:
    - follow_redirects=True (always enabled)
    - Default timeout of 30 seconds if not specified

    Args:
        headers: Optional headers to include with all requests.
        timeout: Request timeout as httpx.Timeout object.
            Defaults to 30 seconds if not specified.
        auth: Optional authentication handler.

    Returns:
        Configured httpx.AsyncClient instance with MCP defaults.

    Note:
        The returned AsyncClient must be used as a context manager to ensure
        proper cleanup of connections.

    Examples:
        # Basic usage with MCP defaults
        async with create_mcp_http_client() as client:
            response = await client.get("https://api.example.com")

        # With custom headers
        headers = {"Authorization": "Bearer token"}
        async with create_mcp_http_client(headers) as client:
            response = await client.get("/endpoint")

        # With both custom headers and timeout
        timeout = httpx.Timeout(60.0, read=300.0)
        async with create_mcp_http_client(headers, timeout) as client:
            response = await client.get("/long-request")

        # With authentication
        from httpx import BasicAuth
        auth = BasicAuth(username="user", password="pass")
        async with create_mcp_http_client(headers, timeout, auth) as client:
            response = await client.get("/protected-endpoint")
    Úfollow_redirectsT)Úreadr   r
   r   r   )r   r   r   r   r   )r
   r   r   Úkwargss       r   r   r      sp   € ð^ 	˜Dð€Fð
 €Ü!ŸM™MÔ*=ÔD`ÔaˆˆyÒà#ˆˆyÑð ÐØ#ˆˆyÑð ÐØˆˆv‰ä×ÑÑ&˜vÑ&Ð&r   r   )Ú__doc__Útypingr   r   r   Ú__all__r   r   r	   r   r   r   r   r   r   r   r   r   ú<module>r%      s‹   ðÙ Fç  ã â
[€ð Ð Ø$Ð ô ˜8ô  ð &*Ø$(Ø"ñ@'Ø�#�s�(‰^˜dÑ"ð@'à�]‰]˜TÑ!ð@'ð �*‰*�tÑ
ð@'ð ×Ñô	@'r   