name : base.cpython-39.pyc
a

\��`"�@s\dZddlZddlZddlmZmZmZmZmZm	Z	m
Z
e�e�Z
Gdd�d�Zdd�ZdS)	z�
oauthlib.oauth2.rfc6749
~~~~~~~~~~~~~~~~~~~~~~~

This module is an implementation of various logic needed
for consuming and providing OAuth 2.0 RFC6749.
�N�)�FatalClientError�InvalidClientError�InvalidRequestError�OAuth2Error�ServerError�TemporarilyUnavailableError�UnsupportedTokenTypeErrorc@s�eZdZdd�Zedd��Zejdd��Zedd��Zejdd��Zed	d
��Zejdd
��Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�BaseEndpointcCsd|_d|_d|_dS)NTF)�
_available�
_catch_errors�_valid_request_methods��self�r�J/usr/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/endpoints/base.py�__init__szBaseEndpoint.__init__cCs|jS�N�r
rrrr�valid_request_methodssz"BaseEndpoint.valid_request_methodscCs |durdd�|D�}||_dS)NcSsg|]}|���qSr)�upper)�.0�xrrr�
<listcomp>!�z6BaseEndpoint.valid_request_methods.<locals>.<listcomp>r)rrrrrrscCs|jSr�rrrrr�	available%szBaseEndpoint.availablecCs
||_dSrr)rrrrrr)scCs|jSr�rrrrr�catch_errors-szBaseEndpoint.catch_errorscCs
||_dSrr)rrrrrr1scCs|jst|dd��dS)zRaise error on missing token.zMissing token parameter.��request�descriptionN)�tokenr�rr rrr�_raise_on_missing_token5s�z$BaseEndpoint._raise_on_missing_tokencCsZ|j�|�r0|j�|�sVt�d|�t|d��n&|j�|j|�sVt�d|�t|d��dS)z&Raise on failed client authentication.z!Client authentication failed, %r.�r N)Zrequest_validatorZclient_authentication_requiredZauthenticate_client�log�debugrZauthenticate_client_idZ	client_idr#rrr�_raise_on_invalid_client:sz%BaseEndpoint._raise_on_invalid_clientcCs,|jr(|j|jvr(|j|jvr(t|d��dS)zRaise on unsupported tokens.r%N)Ztoken_type_hintZvalid_token_typesZsupported_token_typesr	r#rrr�_raise_on_unsupported_tokenDs
�
�z(BaseEndpoint._raise_on_unsupported_tokencCs<|jdurtd��|j��|jvr8t|d|j��d��dS)Nz0Configure "valid_request_methods" property firstzUnsupported request method %sr)r�
ValueError�http_methodrrr#rrr�_raise_on_bad_methodKs
�z!BaseEndpoint._raise_on_bad_methodcCs,|j��dkr(|jpd}|r(t|dd��dS)z/Raise if invalid POST request received
        ZPOST�z$URL query parameters are not allowedrN)r+rZ	uri_queryr)rr Zquery_paramsrrr�_raise_on_bad_post_requestRs
�z'BaseEndpoint._raise_on_bad_post_requestN)�__name__�
__module__�__qualname__r�propertyr�setterrrr$r(r)r,r.rrrrr
s$






r
cst����fdd��}|S)Nc
s�|js&t�}t�d|�i|jdfS|jr�z�||g|�Ri|��WStyZ�Yq�tyl�Yq�ty�}z,t	�}t�
d|�i|jdfWYd}~Sd}~00n�||g|�Ri|��SdS)Nz*Endpoint unavailable, ignoring request %s.i�z.Exception caught while processing request, %s.i�)rrr&�infoZjsonrrr�	ExceptionrZwarning)ZendpointZuri�args�kwargs�e�error��frr�wrapper\s$�$z0catch_errors_and_unavailability.<locals>.wrapper)�	functools�wraps)r;r<rr:r�catch_errors_and_unavailability[sr?)�__doc__r=Zlogging�errorsrrrrrrr	Z	getLoggerr/r&r
r?rrrr�<module>s$
H

© 2025 Cubjrnet7