
    (ph              
           S r SSKJr  SSKrSSKJr  \" \R                  R                  S5      (       a  SS0r	OSS0r	\R                  " SSSSS	S
/SSS.\	D6r
Sr " S S5      r " S S\5      rg)zoInternal HTTP client module.

This module provides utilities for making HTTP calls using the requests library.
    )	transportN)retryallowed_methodsmethod_whitelist      i  i  Fg      ?)connectreadstatusstatus_forcelistraise_on_statusbackoff_factorx   c                       \ rS rSrSrSSSS\\4S jr\S 5       r	\S 5       r
\S 5       rS	 rS
 rS rS rS rS rS rSrg)
HttpClient(   zBase HTTP client used to make HTTP calls.

HttpClient maintains an HTTP session, and handles request authentication and retries if
necessary.
N c                    U(       a%  [         R                  R                  U5      U l        O(U(       a  X l        O[        R                  " 5       U l        U(       a%  U R                  R
                  R                  U5        U(       an  U R                  R                  S[        R                  R                  US95        U R                  R                  S[        R                  R                  US95        X0l
        X`l        g)ay  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mountadaptersHTTPAdapter	_base_url_timeout)self
credentialsessionbase_urlr   retriestimeouts          N/var/www/html/venv/lib/python3.13/site-packages/firebase_admin/_http_client.py__init__HttpClient.__init__/   s    & %..@@LDM#M$,,.DMMM!!((1MM	8+<+<+H+HU\+H+]^MM
H,=,=,I,IV],I,^_!    c                     U R                   $ N)r   r!   s    r'   r#   HttpClient.sessionQ       }}r*   c                     U R                   $ r,   )r   r-   s    r'   r$   HttpClient.base_urlU   s    ~~r*   c                     U R                   $ r,   )r    r-   s    r'   r&   HttpClient.timeoutY   r/   r*   c                     [         er,   )NotImplementedErrorr!   resps     r'   
parse_bodyHttpClient.parse_body]   s    !!r*   c                     SU;  a  U R                   US'   U R                  R                  " XR                  U-   40 UD6nUR	                  5         U$ )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kwargsr7   s        r'   r;   HttpClient.request`   sM    ( F" $F9}}$$V]]S-@KFKr*   c                 @    U R                   " X40 UD6nUR                  $ r,   )r;   r   r=   s        r'   r   HttpClient.headersz   s    ||F262||r*   c                 N    U R                   " X40 UD6nU R                  U5      U4$ r,   r;   r8   r=   s        r'   body_and_responseHttpClient.body_and_response~   s)    ||F262t$d**r*   c                 J    U R                   " X40 UD6nU R                  U5      $ r,   rE   r=   s        r'   bodyHttpClient.body   s$    ||F262t$$r*   c                 b    U R                   " X40 UD6nUR                  U R                  U5      4$ r,   )r;   r   r8   r=   s        r'   headers_and_bodyHttpClient.headers_and_body   s-    ||F262||T__T222r*   c                 F    U R                   R                  5         S U l         g r,   )r   closer-   s    r'   rO   HttpClient.close   s    r*   )r   r   r    )__name__
__module____qualname____firstlineno____doc__DEFAULT_RETRY_CONFIGDEFAULT_TIMEOUT_SECONDSr(   propertyr#   r$   r&   r8   r;   r   rF   rI   rL   rO   __static_attributes__ r*   r'   r   r   (   s}     "4"d(2I  D      "4+%3r*   r   c                   $    \ rS rSrSrS rS rSrg)JsonHttpClient   z5An HTTP client that parses response messages as JSON.c                 2    [         R                  " U 40 UD6  g r,   )r   r(   )r!   r@   s     r'   r(   JsonHttpClient.__init__   s    D+F+r*   c                 "    UR                  5       $ r,   )jsonr6   s     r'   r8   JsonHttpClient.parse_body   s    yy{r*   rZ   N)rQ   rR   rS   rT   rU   r(   r8   rY   rZ   r*   r'   r\   r\      s    ?,r*   r\   rZ   )rU   google.authr   r   requests.packages.urllib3.utilr   hasattrRetryDEFAULT_ANY_METHODrV   rW   r   r\   rZ   r*   r'   <module>ri      s   
 "  0 5;; 122$d+K%t,K {{ >Aa3*#>1<> 
  d dNZ r*   