+
    ÁFñjí3  ã                   ó¦   € R t ^ RIHt ^ RIHt ^ RIt^ RIHt ^ RIH	t	 ^ RI
HtHtHt ^ RIHtHt ^ RIHt ^ R	IHt ]	! ]R
4      t ! R R
]4      tR# )zSThis module contains methods to make POST and GET requests using the httpx library.)Ú
Collection)ÚAnyN)ÚDefaultValue)Ú
get_logger)ÚHTTPVersionÚODVInputÚ	SocketOpt)ÚNetworkErrorÚTimedOut)ÚBaseRequest)ÚRequestDataÚHTTPXRequestc                   ó  a € ] tR t^)t o RtRtRV 3R lR llt]V 3R lR l4       t]V 3R lR l4       t	V 3R	 lR
 lt
V 3R lR ltV 3R lR ltR]P                  ]P                  ]P                  ]P                  3V 3R lR lltRtV tR# )r   ar  Implementation of :class:`~telegram.request.BaseRequest` using the library
`httpx <https://www.python-httpx.org>`_.

.. versionadded:: 20.0

.. versionchanged:: 22.0
    Removed the deprecated parameter ``proxy_url``. Use :paramref:`proxy` instead.

Args:
    connection_pool_size (:obj:`int`, optional): Number of connections to keep in the
        connection pool. Defaults to ``256``.

        .. versionchanged:: 22.4
            Set the default to ``256``.
            Stopped applying to ``httpx.Limits.max_keepalive_connections``. Now only applies to
            ``httpx.Limits.max_connections``. See `Resource Limits
            <https://www.python-httpx.org/advanced/resource-limits/>`_
    read_timeout (:obj:`float` | :obj:`None`, optional): If passed, specifies the maximum
        amount of time (in seconds) to wait for a response from Telegram's server.
        This value is used unless a different value is passed to :meth:`do_request`.
        Defaults to ``5``.
    write_timeout (:obj:`float` | :obj:`None`, optional): If passed, specifies the maximum
        amount of time (in seconds) to wait for a write operation to complete (in terms of
        a network socket; i.e. POSTing a request or uploading a file).
        This value is used unless a different value is passed to :meth:`do_request`.
        Defaults to ``5``.

        Hint:
            This timeout is used for all requests except for those that upload media/files.
            For the latter, :paramref:`media_write_timeout` is used.
    connect_timeout (:obj:`float` | :obj:`None`, optional): If passed, specifies the
        maximum amount of time (in seconds) to wait for a connection attempt to a server
        to succeed. This value is used unless a different value is passed to
        :meth:`do_request`. Defaults to ``5``.
    pool_timeout (:obj:`float` | :obj:`None`, optional): If passed, specifies the maximum
        amount of time (in seconds) to wait for a connection to become available.
        This value is used unless a different value is passed to :meth:`do_request`.
        Defaults to ``1``.

        Warning:
            With a finite pool timeout, you must expect :exc:`telegram.error.TimedOut`
            exceptions to be thrown when more requests are made simultaneously than there are
            connections in the connection pool!
    http_version (:obj:`str`, optional): If ``"2"`` or ``"2.0"``, HTTP/2 will be used instead
        of HTTP/1.1. Defaults to ``"1.1"``.

        .. versionadded:: 20.1
        .. versionchanged:: 20.2
            Reset the default version to 1.1.

        .. versionchanged:: 20.5
            Accept ``"2"`` as a valid value.
    socket_options (Collection[:obj:`tuple`], optional): Socket options to be passed to the
        underlying `library             <https://www.encode.io/httpcore/async/#httpcore.AsyncConnectionPool.__init__>`_.

        Note:
            The values accepted by this parameter depend on the operating system.
            This is a low-level parameter and should only be used if you are familiar with
            these concepts.

        .. versionadded:: 20.7
    proxy (:obj:`str` | ``httpx.Proxy`` | ``httpx.URL``, optional): The URL to a proxy server,
        a ``httpx.Proxy`` object or a ``httpx.URL`` object. For example
        ``'http://127.0.0.1:3128'`` or ``'socks5://127.0.0.1:3128'``. Defaults to :obj:`None`.

        Note:
            * The proxy URL can also be set via the environment variables ``HTTPS_PROXY`` or
              ``ALL_PROXY``. See `the docs of httpx`_ for more info.
            * HTTPS proxies can be configured by passing a ``httpx.Proxy`` object with
              a corresponding ``ssl_context``.
            * For Socks5 support, additional dependencies are required. Make sure to install
              PTB via :command:`pip install "python-telegram-bot[socks]"` in this case.
            * Socks5 proxies can not be set via environment variables.

        .. _the docs of httpx: https://www.python-httpx.org/environment_variables/#proxies

        .. versionadded:: 20.7
    media_write_timeout (:obj:`float` | :obj:`None`, optional): Like :paramref:`write_timeout`,
        but used only for requests that upload media/files. This value is used unless a
        different value is passed to :paramref:`do_request.write_timeout` of
        :meth:`do_request`. Defaults to ``20`` seconds.

        .. versionadded:: 21.0
    httpx_kwargs (dict[:obj:`str`, Any], optional): Additional keyword arguments to be passed
        to the `httpx.AsyncClient <https://www.python-httpx.org/api/#asyncclient>`_
        constructor.

        Warning:
            This parameter is intended for advanced users that want to fine-tune the behavior
            of the underlying ``httpx`` client. The values passed here will override all the
            defaults set by ``python-telegram-bot`` and all other parameters passed to
            :class:`HTTPXRequest`. The only exception is the :paramref:`media_write_timeout`
            parameter, which is not passed to the client constructor.
            No runtime warnings will be issued about parameters that are overridden in this
            way.

        .. versionadded:: 21.6

Nc                ó4  <€ V ^8„  d   QhRS[ RS[R,          RS[R,          RS[R,          RS[R,          RS[RS[S[,          R,          R	S[S[P                  ,          S[P                  ,          R,          R
S[R,          RS[	S[S[
3,          R,          /
# )é   Úconnection_pool_sizeÚread_timeoutNÚwrite_timeoutÚconnect_timeoutÚpool_timeoutÚhttp_versionÚsocket_optionsÚproxyÚmedia_write_timeoutÚhttpx_kwargs)ÚintÚfloatr   r   r   ÚstrÚhttpxÚProxyÚURLÚdictr   )ÚformatÚ__classdict__s   "€ÚT/opt/hermes-site/venv/lib/python3.14/site-packages/telegram/request/_httpxrequest.pyÚ__annotate__ÚHTTPXRequest.__annotate__‘   s±   ø€ ÷ <ñ <á!ð<ñ ˜d•lð<ñ ˜t•|ð	<ñ
  �ð<ñ ˜d•lð<ñ "ð<ñ #¡9Õ-°Õ4ð<ñ ‘U—[‘[Õ ¡5§9¡9Õ,¨tÕ3ð<ñ # T�\ð<ñ ™3¡˜8•n tÕ+ñ<ó    c                ó$  € W`n         W�n        \        P                  ! VVVVR 7      p\        P                  ! VR7      pVR9  d   \        R4      hVR8H  pRVRV'       * /pV'       d   \        P                  ! VR7      MRpRVR	VR
VRV/VCT
;'       g    / CV n         V P                  4       V n	        R#   \         dO   pR\        T4      9  d   R\        T4      9  d   h R\        T4      9   d   \        R4      Th\        R4      ThRp?ii ; i)©ÚconnectÚreadÚwriteÚpool)Úmax_connectionsú1.1z2`http_version` must be either '1.1', '2.0' or '2'.Úhttp1Úhttp2)r   NÚtimeoutr   ÚlimitsÚ	transportzhttpx[http2]zhttpx[socks]z\To use Socks5 proxies, PTB must be installed via `pip install "python-telegram-bot[socks]"`.zTTo use HTTP/2, PTB must be installed via `pip install "python-telegram-bot[http2]"`.)r/   Ú2z2.0)Ú_http_versionÚ_media_write_timeoutr   ÚTimeoutÚLimitsÚ
ValueErrorÚAsyncHTTPTransportÚ_client_kwargsÚ_build_clientÚ_clientÚImportErrorr   ÚRuntimeError)Úselfr   r   r   r   r   r   r   r   r   r   r2   r3   r0   Úhttp_kwargsr4   Úexcs   &&&&&&&&&&&      r$   Ú__init__ÚHTTPXRequest.__init__‘   sG  € ð *ÔØ$7Ô!Ü—-’-Ø#ØØØô	
ˆô —’Ø0ô
ˆð Ð2Ô2ÜÐQÓRÐRà Ñ%ˆØ  w°E´	Ð:ˆ÷
 ô ×$Ò$Ø-õð ð 	ð �wØ�UØ�fØ˜ð	
ð
 ð
ð ×!Ð!˜rð
ˆÔð	Ø×-Ñ-Ó/ˆDŽLøÜô 	Ø¤S¨£XÔ-°.ÌÈCËÔ2PØà¤ S£Ô)Ü"ð5óð ðô ð1óð ðûð	ús   ÂB6 Â6DÃA	D
Ä
Dc                ó    <€ V ^8„  d   QhRS[ /# ©r   Úreturn)r   )r"   r#   s   "€r$   r%   r&   Ð   s   ø€ ÷ "ñ "™cñ "r'   c                ó   € V P                   # )zV
:obj:`str`: Used HTTP version, see :paramref:`http_version`.

.. versionadded:: 20.2
)r6   ©rA   s   &r$   r   ÚHTTPXRequest.http_versionÏ   s   € ð ×!Ñ!Ð!r'   c                ó.   <€ V ^8„  d   QhRS[ R,          /# ©r   rH   N)r   )r"   r#   s   "€r$   r%   r&   Ù   s   ø€ ÷ )ñ )™e d�lñ )r'   c                óB   € V P                   P                  P                  # )z°See :attr:`BaseRequest.read_timeout`.

Returns:
    :obj:`float` | :obj:`None`: The default read timeout in seconds as passed to
        :paramref:`HTTPXRequest.read_timeout`.
)r>   r2   r+   rJ   s   &r$   r   ÚHTTPXRequest.read_timeoutØ   s   € ð �|‰|×#Ñ#×(Ñ(Ð(r'   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rG   )r   ÚAsyncClient)r"   r#   s   "€r$   r%   r&   â   s   ø€ ÷ 8ñ 8™u×0Ñ0ñ 8r'   c                óB   € \         P                  ! R/ V P                  B # )N© )r   rQ   r<   rJ   s   &r$   r=   ÚHTTPXRequest._build_clientâ   s   € Ü× Ò Ñ7 4×#6Ñ#6Ñ7Ð7r'   c                ó   <€ V ^8„  d   QhRR/# rM   rS   )r"   r#   s   "€r$   r%   r&   å   s   ø€ ÷ 0ñ 0 $ñ 0r'   c              ƒ  ót   "  € V P                   P                  '       d   V P                  4       V n         R# R# 5i)z#See :meth:`BaseRequest.initialize`.N)r>   Ú	is_closedr=   rJ   s   &r$   Ú
initializeÚHTTPXRequest.initializeå   s*   é € à�<‰<×!×!Ð!Ø×-Ñ-Ó/ˆDŽLñ "ùs   ‚68c                ó   <€ V ^8„  d   QhRR/# rM   rS   )r"   r#   s   "€r$   r%   r&   ê   s   ø€ ÷ $ñ $ ñ $r'   c              ƒ  ó¼   "  € V P                   P                  '       d   \        P                  R4       R# V P                   P	                  4       G Rj  x€L
  R#  L5i)z!See :meth:`BaseRequest.shutdown`.z2This HTTPXRequest is already shut down. Returning.N)r>   rW   Ú_LOGGERÚdebugÚacloserJ   s   &r$   ÚshutdownÚHTTPXRequest.shutdownê   s;   é € à�<‰<×!×!Ð!Ü�M‰MÐNÔOÙà�l‰l×!Ñ!Ó#×#Ô#ùs   ‚AAÁAÁAc                ó®   <€ V ^8„  d   QhRS[ RS[ RS[R,          RS[S[,          RS[S[,          RS[S[,          RS[S[,          R	S[S[S[3,          /# )
r   ÚurlÚmethodÚrequest_dataNr   r   r   r   rH   )r   r   r   r   Útupler   Úbytes)r"   r#   s   "€r$   r%   r&   ò   sy   ø€ ÷ ?,ñ ?,áð?,ñ ð?,ñ " DÕ(ð	?,ñ
 ™u•oð?,ñ  ¡•ð?,ñ "¡%�ð?,ñ ™u•oð?,ñ 
‰s‘EˆzÕ	ñ?,r'   c           	   ƒ  óz  "  € V P                   P                  '       d   \        R4      hV'       d   VP                  MRpV'       d   VP                  MRp	\        V\        4      '       d!   V P                   P                  P                  p\        V\        4      '       d!   V P                   P                  P                  p\        V\        4      '       d!   V P                   P                  P                  p\        V\        4      '       d5   V'       g!   V P                   P                  P                  MV P                  p\        P                  ! VVVVR7      p
 V P                   P                  VVRV P                   /V
VV	R7      G Rj  x€L
 pTP0                  TP2                  3#  L  \        P"                   d:   p\        T\        P$                  4      '       d   \'        RR7      Th\&        ThRp?i\        P(                   d,   p\+        RTP,                  P.                   R	T 24      ThRp?ii ; i5i)
z#See :meth:`BaseRequest.do_request`.z%This HTTPXRequest is not initialized!Nr)   z
User-Agent)rc   rb   Úheadersr2   ÚfilesÚdataz§Pool timeout: All connections in the connection pool are occupied. Request was *not* sent to Telegram. Consider adjusting the connection pool size or the pool timeout.)Úmessagezhttpx.z: )r>   rW   r@   Úmultipart_dataÚjson_parametersÚ
isinstancer   r2   r+   r*   r-   r,   r7   r   r8   ÚrequestÚ
USER_AGENTÚTimeoutExceptionÚPoolTimeoutr
   Ú	HTTPErrorr	   Ú	__class__Ú__name__Ústatus_codeÚcontent)rA   rb   rc   rd   r   r   r   r   ri   rj   r2   ÚresÚerrs   &&&&&&&&     r$   Ú
do_requestÚHTTPXRequest.do_requestò   sÉ  é € ð �<‰<×!×!Ð!ÜÐFÓGÐGç/;�×+Ò+Àˆß/;ˆ|×+Ò+Àˆô �l¤L×1Ò1ØŸ<™<×/Ñ/×4Ñ4ˆLÜ�o¤|×4Ò4Ø"Ÿl™l×2Ñ2×:Ñ:ˆOÜ�l¤L×1Ò1ØŸ<™<×/Ñ/×4Ñ4ˆLä�m¤\×2Ò2ß>C˜DŸL™L×0Ñ0×6Ò6È×IbÑIbˆMä—-’-Ø#ØØØô	
ˆð	RØŸ™×,Ñ,ØØØ% t§¡Ð7ØØØð -ó ÷ ˆCð4 �‰ §¡Ð+Ð+ñ5øô ×%Ñ%ô 		$Ü˜#œu×0Ñ0×1Ò1Üð9ôð ðô  Ð#ûÜ�‰ô 	Rô  ¨¯©×(>Ñ(>Ð'?¸rÀ#ÀÐGÓHÈcÐQûð	Rüs`   ‚/H;²H;ÁCH;ÄAH;Å0F, ÆF*ÆF, ÆH;Æ*F, Æ,H8Ç4G5Ç5H8ÈH8È&H3È3H8È8H;)r>   r<   r6   r7   )
é   ç      @r}   r}   g      ð?r/   NNg      4@N)ru   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú	__slots__rD   Úpropertyr   r   r=   rX   r_   r   ÚDEFAULT_NONErz   Ú__static_attributes__Ú__classdictcell__)r#   s   @r$   r   r   )   s�   ø‡ € ñcðJ W€I÷<ò <ð| ÷"ó ð"ð ÷)ó ð)÷8ð 8÷0ð 0÷
$ð $ð ,0Ø(3×(@Ñ(@Ø)4×)AÑ)AØ+6×+CÑ+CØ(3×(@Ñ(@÷?,÷ ?,ð ?,r'   )r�   Úcollections.abcr   Útypingr   r   Útelegram._utils.defaultvaluer   Útelegram._utils.loggingr   Útelegram._utils.typesr   r   r   Útelegram.errorr	   r
   Útelegram.request._baserequestr   Útelegram.request._requestdatar   ru   r\   r   rS   r'   r$   Ú<module>r�      sE   ðñ& Zå &Ý ã å 5Ý .ß BÑ Bß 1Ý 5Ý 5ñ �X˜~Ó
.€ôH,�;ö H,r'   