Sindbad~EG File Manager
3
��c�2 � @ sJ d Z ddlZddlmZmZ G dd� de�ZG dd� de�ZG dd � d e�ZG d
d� de�Z G dd
� d
e�Z
G dd� de�ZG dd� de�ZG dd� de�Z
G dd� de
�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�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.d/� d/e�ZG d0d1� d1e�ZG d2d3� d3e�ZG d4d5� d5e
�ZG d6d7� d7e�ZG d8d9� d9e�Z G d:d;� d;e�Z!G d<d=� d=e�Z"G d>d?� d?e�Z#G d@dA� dAe�Z$G dBdC� dCe�Z%G dDdE� dEe�Z&G dFdG� dGe�Z'dJdHdI�Z(dS )Kz�
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.
� N)�add_params_to_uri� urlencodec sb e Zd ZdZdZdZd� fdd� Zdd� Zedd � �Z ed
d� �Z
edd
� �Zedd� �Z� Z
S )�OAuth2ErrorNi� � c s� |dk r|| _ dj| j| j �}|r2|dt|� 7 }t� j|� || _|| _|rT|| _|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({}) {}� )�description�format�error�repr�super�__init__�uri�state�status_codeZredirect_uriZ client_idZscopesZ
response_type�
response_modeZ
grant_type)�selfr r
r r �request�message)� __class__� �B/tmp/pip-build-_uu8ur7s/oauthlib/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_uriI s
zOAuth2Error.in_uric C sR d| j fg}| jr"|jd| jf� | jr8|jd| jf� | jrN|jd| jf� |S )Nr �error_description� error_urir )r r �appendr
r )r r r r r r M s zOAuth2Error.twotuplesc C s
t | j�S )N)r r )r r r r �
urlencodedX s zOAuth2Error.urlencodedc C s t jt| j��S )N)�json�dumps�dictr )r r r r r \ s zOAuth2Error.jsonc C s^ | j dkrZdj| j�g}| jr0|jdj| j�� | jrH|jdj| j�� dddj|� iS i S )Ni� z
error="{}"zerror_description="{}"zerror_uri="{}"zWWW-AuthenticatezBearer z, )r r r r r r
�join)r Z
authvaluesr r r �headers` s
zOAuth2Error.headers)NNNNN)�__name__�
__module__�__qualname__r r r r r �propertyr r r r"