File: //lib/python3/dist-packages/oauthlib/oauth2/rfc6749/__pycache__/errors.cpython-38.pyc
U
��I]3 � @ sV d Z ddlmZ ddlZddlmZmZ G dd� de�ZG dd� de�Z G d d
� d
e�Z
G dd� de�ZG d
d� de�ZG dd� de�Z
G dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd � d e�ZG d!d"� d"e�ZG d#d$� d$e�ZG d%d&� d&e�ZG d'd(� d(e�ZG d)d*� d*e�ZG d+d,� d,e�ZG d-d.� d.e�ZG d/d0� d0e�ZG d1d2� d2e�ZG d3d4� d4e�ZG d5d6� d6e�Z G d7d8� d8e�Z!G d9d:� d:e�Z"G d;d<� d<e�Z#G d=d>� d>e�Z$G d?d@� d@e�Z%G dAdB� dBe�Z&G dCdD� dDe�Z'G dEdF� dFe�Z(G dGdH� dHe�Z)dKdIdJ�Z*dS )Lz�
oauthlib.oauth2.rfc6749.errors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error used both by OAuth 2 clients and providers to represent the spec
defined error responses for all four core grant types.
� )�unicode_literalsN)�add_params_to_uri� urlencodec sb e Zd ZdZdZdZd� fdd� Zdd� Zedd � �Z ed
d� �Z
edd
� �Zedd� �Z� Z
S )�OAuth2ErrorN� � c s� |dk r|| _ d| j| j f }|r2|dt|� 7 }tt| ��|� || _|| _|rX|| _|r�|j | _ |j
| _
|j| _|j| _|j
| _
|j| _|s�|j| _n$d| _ d| _
d| _d| _d| _
d| _dS )a0
:param description: A human-readable ASCII [USASCII] text providing
additional information, used to assist the client
developer in understanding the error that occurred.
Values for the "error_description" parameter
MUST NOT include characters outside the set
x20-21 / x23-5B / x5D-7E.
:param uri: A URI identifying a human-readable web page with information
about the error, used to provide the client developer with
additional information about the error. Values for the
"error_uri" parameter MUST conform to the URI- Reference
syntax, and thus MUST NOT include characters outside the set
x21 / x23-5B / x5D-7E.
:param state: A CSRF protection value received from the client.
:param status_code:
:param request: OAuthlib request.
:type request: oauthlib.common.Request
Nz(%s) %s� )�description�error�repr�superr �__init__�uri�state�status_codeZredirect_uriZ client_idZscopesZ
response_type�
response_modeZ
grant_type)�selfr r r r Zrequest�message�� __class__� �@/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/errors.pyr
s2
zOAuth2Error.__init__c C s | j dk}t|| j|�S )N�fragment)r r � twotuples)r r r r r r �in_uriL s
zOAuth2Error.in_uric C sR d| j fg}| jr"|�d| jf� | jr8|�d| jf� | jrN|�d| jf� |S )Nr
�error_description� error_urir )r
r �appendr r )r r
r r r r P s zOAuth2Error.twotuplesc C s
t | j�S �N)r r �r r r r �
urlencoded[ s zOAuth2Error.urlencodedc C s t �t| j��S r )�json�dumps�dictr r r r r r! _ s zOAuth2Error.jsonc C s\ | j dkrXdd�| j�g}| jr2|�d�| j�� | jrJ|�d�| j�� dd�|�iS i S )N� ZBearerz
error="{}"zerror_description="{}"zerror_uri="{}"zWWW-Authenticatez, )r �formatr
r r r �join)r Z
authvaluesr r r �headersc s
�zOAuth2Error.headers)NNNNN)�__name__�
__module__�__qualname__r
r r r
r �propertyr r r! r'