Ë
    ö%9ji  ã            
       ó
  — d Z ddlmZ ddlZddlmZ ddlmZ  eej                  j                  d«      rddiZnddiZ ej                  dddd	d
dgdddœe¤ŽZdZd ej                  «       iZ G d„ d«      Z G d„ de«      Zy)zqInternal HTTP client module.

 This module provides utilities for making HTTP calls using the requests library.
 é    )Ú	transportN)Úretry)Ú_utilsÚallowed_methodsÚmethod_whitelisté   é   iô  i÷  Fg      à?)ÚconnectÚreadÚstatusÚstatus_forcelistÚraise_on_statusÚbackoff_factoréx   zX-GOOG-API-CLIENTc                   ó~   — e Zd ZdZddddeefd„Zed„ «       Zed„ «       Z	ed„ «       Z
d„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zy)Ú
HttpClientzšBase HTTP client used to make HTTP calls.

    HttpClient maintains an HTTP session, and handles request authentication and retries if
    necessary.
    NÚ c                 ó@  — |r%t         j                  j                  |«      | _        n#|r|| _        nt        j                  «       | _        |r%| j                  j
                  j                  |«       | j                  j
                  j                  t        «       |rt| j                  j                  dt        j                  j                  |¬«      «       | j                  j                  dt        j                  j                  |¬«      «       || _        || _        y)aá  Creates a new HttpClient instance from the provided arguments.

        If a credential is provided, initializes a new HTTP session authorized with it. If neither
        a credential nor a session is provided, initializes a new unauthorized session.

        Args:
          credential: A Google credential that can be used to authenticate requests (optional).
          session: A custom HTTP session (optional).
          base_url: A URL prefix to be added to all outgoing requests (optional).
          headers: A map of headers to be added to all outgoing requests (optional).
          retries: A urllib retry configuration. Default settings would retry once for low-level
              connection and socket read errors, and up to 4 times for HTTP 500 and 503 errors.
              Pass a False value to disable retries (optional).
          timeout: HTTP timeout in seconds. Defaults to 120 seconds when not specified. Set to
              None to disable timeouts (optional).
        zhttp://)Úmax_retrieszhttps://N)r   ÚrequestsÚAuthorizedSessionÚ_sessionÚSessionÚheadersÚupdateÚMETRICS_HEADERSÚmountÚadaptersÚHTTPAdapterÚ	_base_urlÚ_timeout)ÚselfÚ
credentialÚsessionÚbase_urlr   ÚretriesÚtimeouts          úW/var/www/html/truck-me/venv/lib/python3.12/site-packages/firebase_admin/_http_client.pyÚ__init__zHttpClient.__init__3   sÏ   € ñ& Ü%×.Ñ.×@Ñ@ÀÓLˆD�MÙØ#ˆD�Mä$×,Ñ,Ó.ˆDŒMáØ�M‰M×!Ñ!×(Ñ(¨Ô1Ø�‰×Ñ×$Ñ$¤_Ô5ÙØ�M‰M×Ñ 	¬8×+<Ñ+<×+HÑ+HÐU\Ð+HÓ+]Ô^Ø�M‰M×Ñ 
¬H×,=Ñ,=×,IÑ,IÐV]Ð,IÓ,^Ô_Ø!ˆŒØˆ�ó    c                 ó   — | j                   S ©N)r   ©r"   s    r(   r$   zHttpClient.sessionV   ó   € à�}‰}Ðr*   c                 ó   — | j                   S r,   )r    r-   s    r(   r%   zHttpClient.base_urlZ   s   € à�~‰~Ðr*   c                 ó   — | j                   S r,   )r!   r-   s    r(   r'   zHttpClient.timeout^   r.   r*   c                 ó   — t         ‚r,   )ÚNotImplementedError©r"   Úresps     r(   Ú
parse_bodyzHttpClient.parse_bodyb   s   € Ü!Ð!r*   c                 ó¢   — d|vr| j                   |d<    | j                  j                  || j                  |z   fi |¤Ž}|j	                  «        |S )a	  Makes an HTTP call using the Python requests library.

        This is the sole entry point to the requests library. All other helper methods in this
        class call this method to send HTTP requests out. Refer to
        http://docs.python-requests.org/en/master/api/ for more information on supported options
        and features.

        Args:
          method: HTTP method name as a string (e.g. get, post).
          url: URL of the remote endpoint.
          **kwargs: An additional set of keyword arguments to be passed into the requests API
              (e.g. json, params, timeout).

        Returns:
          Response: An HTTP response object.

        Raises:
          RequestException: Any requests exceptions encountered while making the HTTP call.
        r'   )r'   r   Úrequestr%   Úraise_for_status©r"   ÚmethodÚurlÚkwargsr4   s        r(   r7   zHttpClient.requeste   sQ   € ð( ˜FÑ"Ø $§¡ˆF�9ÑØ$ˆt�}‰}×$Ñ$ V¨T¯]©]¸SÑ-@ÑKÀFÑKˆØ×ÑÔØˆr*   c                 óB   —  | j                   ||fi |¤Ž}|j                  S r,   )r7   r   r9   s        r(   r   zHttpClient.headers   s#   € Øˆt�|‰|˜F CÑ2¨6Ñ2ˆØ�|‰|Ðr*   c                 óP   —  | j                   ||fi |¤Ž}| j                  |«      |fS r,   ©r7   r5   r9   s        r(   Úbody_and_responsezHttpClient.body_and_responseƒ   s-   € Øˆt�|‰|˜F CÑ2¨6Ñ2ˆØ�‰˜tÓ$ dÐ*Ð*r*   c                 óL   —  | j                   ||fi |¤Ž}| j                  |«      S r,   r?   r9   s        r(   ÚbodyzHttpClient.body‡   s(   € Øˆt�|‰|˜F CÑ2¨6Ñ2ˆØ�‰˜tÓ$Ð$r*   c                 ód   —  | j                   ||fi |¤Ž}|j                  | j                  |«      fS r,   )r7   r   r5   r9   s        r(   Úheaders_and_bodyzHttpClient.headers_and_body‹   s1   € Øˆt�|‰|˜F CÑ2¨6Ñ2ˆØ�|‰|˜TŸ_™_¨TÓ2Ð2Ð2r*   c                 óF   — | j                   j                  «        d | _         y r,   )r   Úcloser-   s    r(   rF   zHttpClient.close�   s   € Ø�‰×ÑÔØˆ�r*   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚDEFAULT_RETRY_CONFIGÚDEFAULT_TIMEOUT_SECONDSr)   Úpropertyr$   r%   r'   r5   r7   r   r@   rB   rD   rF   © r*   r(   r   r   ,   s}   „ ñð "¨4¸"ÀdØ(Ð2Ió! ðF ñó ðð ñó ðð ñó ðò"òò4ò+ò%ò3ór*   r   c                   ó   — e Zd ZdZd„ Zd„ Zy)ÚJsonHttpClientz5An HTTP client that parses response messages as JSON.c                 ó0   — t        j                  | fi |¤Ž y r,   )r   r)   )r"   r<   s     r(   r)   zJsonHttpClient.__init__—   s   € Ü×Ñ˜DÑ+ FÓ+r*   c                 ó"   — |j                  «       S r,   )Újsonr3   s     r(   r5   zJsonHttpClient.parse_bodyš   s   € Ø�y‰y‹{Ðr*   N)rG   rH   rI   rJ   r)   r5   rN   r*   r(   rP   rP   ”   s   „ Ù?ò,ór*   rP   rN   )rJ   Úgoogle.authr   r   Úrequests.packages.urllib3.utilr   Úfirebase_adminr   ÚhasattrÚRetryÚDEFAULTÚ_ANY_METHODrK   rL   Úget_metrics_headerr   r   rP   rN   r*   r(   ú<module>r\      s®   ðñõ
 "Û Ý 0å !á
ˆ5�;‰;×ÑÐ 1Ô2Ø$ dÐ+�Kà% tÐ,€Kð #�u—{‘{ð >Ø�A˜a°3¸°*Ø¨#ñ>à1<ñ>Ð ð
 Ð ð Ð2˜×2Ñ2Ó4ð€÷eñ eôP�Zõ r*   