Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
base.py27 linesDownload Raw Back to oauth2
1from authlib.common.errors import AuthlibHTTPError2from authlib.common.urls import add_params_to_uri3 4 5class OAuth2Error(AuthlibHTTPError):6    def __init__(self, description=None, uri=None,7                 status_code=None, state=None,8                 redirect_uri=None, redirect_fragment=False, error=None):9        super().__init__(error, description, uri, status_code)10        self.state = state11        self.redirect_uri = redirect_uri12        self.redirect_fragment = redirect_fragment13 14    def get_body(self):15        """Get a list of body."""16        error = super().get_body()17        if self.state:18            error.append(('state', self.state))19        return error20 21    def __call__(self, uri=None):22        if self.redirect_uri:23            params = self.get_body()24            loc = add_params_to_uri(self.redirect_uri, params, self.redirect_fragment)25            return 302, '', [('Location', loc)]26        return super().__call__(uri=uri)27 
codekingpro/portable-devtools · Team Ai