o
    a	                     @   sh   d Z ddlmZmZ G dd deZG dd deZG dd deZG d	d
 d
eZG dd deZ	dS )z
oauthlib.oauth1.rfc5849.errors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error used both by OAuth 1 clients and provicers to represent the spec
defined error responses for all four core grant types.
    )add_params_to_uri	urlencodec                       sJ   e Zd ZdZdZ		d fdd	Zdd Zedd	 Zed
d Z	  Z
S )OAuth1ErrorN   c                    sL   |p| j | _ d| j| j }|r|dt| 7 }t | || _|| _dS )a  
        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.

        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.

        state:  A CSRF protection value received from the client.

        request:  Oauthlib Request object
        z({}) {} N)descriptionformaterrorreprsuper__init__uristatus_code)selfr   r   r   requestmessage	__class__ @/usr/lib/python3/dist-packages/oauthlib/oauth1/rfc5849/errors.pyr      s   
zOAuth1Error.__init__c                 C   s   t || jS N)r   	twotuples)r   r   r   r   r   in_uri-   s   zOAuth1Error.in_uric                 C   s<   d| j fg}| jr|d| jf | jr|d| jf |S )Nr
   error_description	error_uri)r
   r   appendr   )r   r
   r   r   r   r   0   s   zOAuth1Error.twotuplesc                 C   s
   t | jS r   )r   r   )r   r   r   r   
urlencoded9   s   
zOAuth1Error.urlencoded)NNr   N)__name__
__module____qualname__r
   r   r   r   propertyr   r   __classcell__r   r   r   r   r      s    
r   c                   @   s   e Zd ZdZdZdS )InsecureTransportErrorinsecure_transport_protocolz%Only HTTPS connections are permitted.N)r   r   r    r
   r   r   r   r   r   r#   >   s    r#   c                   @      e Zd ZdZdS )InvalidSignatureMethodErrorinvalid_signature_methodNr   r   r    r
   r   r   r   r   r&   C       r&   c                   @   r%   )InvalidRequestErrorinvalid_requestNr(   r   r   r   r   r*   G   r)   r*   c                   @   r%   )InvalidClientErrorinvalid_clientNr(   r   r   r   r   r,   K   r)   r,   N)
__doc__oauthlib.commonr   r   	Exceptionr   r#   r&   r*   r,   r   r   r   r   <module>   s    3