Пример #1
0
    def __init__(self, client_id=None, client_secret=None,
                 token_endpoint_auth_method=None,
                 revocation_endpoint_auth_method=None,
                 scope=None, redirect_uri=None,
                 token=None, token_placement='header',
                 update_token=None, **kwargs):

        # extract httpx.Client kwargs
        client_kwargs = self._extract_session_request_params(kwargs)
        AsyncClient.__init__(self, **client_kwargs)

        # We use a "reverse" Event to synchronize coroutines to prevent
        # multiple concurrent attempts to refresh the same token
        self._token_refresh_event = asyncio.Event()
        self._token_refresh_event.set()

        _OAuth2Client.__init__(
            self, session=None,
            client_id=client_id, client_secret=client_secret,
            token_endpoint_auth_method=token_endpoint_auth_method,
            revocation_endpoint_auth_method=revocation_endpoint_auth_method,
            scope=scope, redirect_uri=redirect_uri,
            token=token, token_placement=token_placement,
            update_token=update_token, **kwargs
        )
Пример #2
0
    def __init__(self,
                 client_id=None,
                 client_secret=None,
                 token_endpoint_auth_method=None,
                 revocation_endpoint_auth_method=None,
                 scope=None,
                 redirect_uri=None,
                 token=None,
                 token_placement='header',
                 update_token=None,
                 **kwargs):

        # extract httpx.Client kwargs
        client_kwargs = self._extract_session_request_params(kwargs)
        Client.__init__(self, **client_kwargs)

        _OAuth2Client.__init__(
            self,
            session=self,
            client_id=client_id,
            client_secret=client_secret,
            token_endpoint_auth_method=token_endpoint_auth_method,
            revocation_endpoint_auth_method=revocation_endpoint_auth_method,
            scope=scope,
            redirect_uri=redirect_uri,
            token=token,
            token_placement=token_placement,
            update_token=update_token,
            **kwargs)
Пример #3
0
 def __init__(self,
              client_id=None,
              client_secret=None,
              token_endpoint_auth_method=None,
              refresh_token_url=None,
              refresh_token_params=None,
              scope=None,
              redirect_uri=None,
              token=None,
              token_placement='header',
              state=None,
              token_updater=None,
              **kwargs):
     Session.__init__(self)
     OAuth2Client.__init__(self,
                           session=self,
                           client_id=client_id,
                           client_secret=client_secret,
                           client_auth_method=token_endpoint_auth_method,
                           refresh_token_url=refresh_token_url,
                           refresh_token_params=refresh_token_params,
                           scope=scope,
                           redirect_uri=redirect_uri,
                           token=token,
                           token_placement=token_placement,
                           state=state,
                           token_updater=token_updater,
                           **kwargs)
     self.token_endpoint_auth_method = token_endpoint_auth_method
Пример #4
0
    def __init__(self,
                 client_id=None,
                 client_secret=None,
                 token_endpoint_auth_method=None,
                 revocation_endpoint_auth_method=None,
                 scope=None,
                 redirect_uri=None,
                 token=None,
                 token_placement='header',
                 update_token=None,
                 **kwargs):

        Session.__init__(self)
        OAuth2Client.__init__(
            self,
            session=self,
            client_id=client_id,
            client_secret=client_secret,
            token_endpoint_auth_method=token_endpoint_auth_method,
            revocation_endpoint_auth_method=revocation_endpoint_auth_method,
            scope=scope,
            redirect_uri=redirect_uri,
            token=token,
            token_placement=token_placement,
            update_token=update_token,
            **kwargs)
Пример #5
0
    def __init__(self,
                 client_id=None,
                 client_secret=None,
                 authorization_endpoint=None,
                 token_endpoint=None,
                 token_endpoint_auth_method=None,
                 revocation_endpoint=None,
                 revocation_endpoint_auth_method=None,
                 scope=None,
                 redirect_uri=None,
                 token=None,
                 token_placement='header',
                 token_updater=None,
                 **kwargs):

        refresh_token_url = kwargs.pop('refresh_token_url', None)
        if refresh_token_url is not None and token_endpoint is None:
            token_endpoint = refresh_token_url

        Session.__init__(self)
        OAuth2Client.__init__(
            self,
            session=self,
            client_id=client_id,
            client_secret=client_secret,
            authorization_endpoint=authorization_endpoint,
            token_endpoint=token_endpoint,
            token_endpoint_auth_method=token_endpoint_auth_method,
            revocation_endpoint=revocation_endpoint,
            revocation_endpoint_auth_method=revocation_endpoint_auth_method,
            scope=scope,
            redirect_uri=redirect_uri,
            token=token,
            token_placement=token_placement,
            token_updater=token_updater,
            **kwargs)
Пример #6
0
 def __init__(self,
              client_id=None,
              client_secret=None,
              token_endpoint=None,
              token_endpoint_auth_method=None,
              scope=None,
              redirect_uri=None,
              token=None,
              token_placement='header',
              token_updater=None,
              **kwargs):
     session = ClientSession(request_class=OAuth2Request)
     _OAuth2Client.__init__(self,
                            session=session,
                            client_id=client_id,
                            client_secret=client_secret,
                            client_auth_method=token_endpoint_auth_method,
                            refresh_token_url=token_endpoint,
                            scope=scope,
                            redirect_uri=redirect_uri,
                            token=token,
                            token_placement=token_placement,
                            token_updater=token_updater,
                            **kwargs)