File: //usr/local/CyberCP/lib/python3.10/site-packages/google/oauth2/__pycache__/_client.cpython-310.pyc
o
�h_D � @ s� d Z ddlZddlmZ ddlZddlZddlmZ ddlm Z ddlm
Z
ddlmZ ddlmZ ddlm
Z
d Zd
ZdZdZd
d� Zdd� Zdd� Z d#dd�Z d#dd�Zd$dd�Zdd� Zd$dd�Zdd � Z d%d!d"�ZdS )&a OAuth 2.0 client.
This is a client for interacting with an OAuth 2.0 authorization server's
token endpoint.
For more information about the token endpoint, see
`Section 3.1 of rfc6749`_
.. _Section 3.1 of rfc6749: https://tools.ietf.org/html/rfc6749#section-3.2
� N)�_exponential_backoff)�_helpers)�
exceptions)�jwt)�metrics)� transportz!application/x-www-form-urlencodedzapplication/jsonz+urn:ietf:params:oauth:grant-type:jwt-bearer�
refresh_tokenc C sp |r|nd}t | t�rtj| |d��z
d�| d | �d��}W n ttfy/ t� | �}Y nw tj|| |d��)aX Translates an error response into an exception.
Args:
response_data (Mapping | str): The decoded response data.
retryable_error Optional[bool]: A boolean indicating if an error is retryable.
Defaults to False.
Raises:
google.auth.exceptions.RefreshError: The errors contained in response_data.
F�� retryablez{}: {}�error�error_description)
�
isinstance�strr �RefreshError�format�get�KeyError�
ValueError�json�dumps)�
response_data�retryable_error�
error_details� r �H/usr/local/CyberCP/lib/python3.10/site-packages/google/oauth2/_client.py�_handle_error_response, s
���r c s� | t jv rdS z2|�d�pd}|�d�pd}t|t�r t|t�s#W dS h d�� t� fdd�||fD ��r7W dS W dS tyC Y dS w ) a; Checks if a request can be retried by inspecting the status code
and response body of the request.
Args:
status_code (int): The response status code.
response_data (Mapping | str): The decoded response data.
Returns:
bool: True if the response is retryable. False otherwise.
Tr � r F> �server_error�internal_failure�temporarily_unavailablec 3 s � | ]}|� v V qd S )Nr )�.0�e��retryable_error_descriptionsr r � <genexpr>g s � z_can_retry.<locals>.<genexpr>)r �DEFAULT_RETRYABLE_STATUS_CODESr r
r �any�AttributeError)�status_coder �
error_desc�
error_coder r"