How to use the keyring.get_keyring function in keyring

To help you get started, we’ve selected a few keyring examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github osteele / ipython-secrets / ipython_secrets.py View on Github external
def iter_credentials():
        try:
            yield keyring.get_keyring().credentials
        except AttributeError:
            pass

        try:
            from oauth2client.client import (ApplicationDefaultCredentialsError,
                                             GoogleCredentials)
            yield GoogleCredentials.get_application_default()
        except (ApplicationDefaultCredentialsError, ImportError):
            pass
github SamSchott / maestral-dropbox / maestral / sync / oauth.py View on Github external
def load_token(self):
        """
        Check if auth key has been saved.

        :raises: ``KeyringLocked`` if the system keyring cannot be accessed.
        """
        logger.debug("Using keyring: %s" % keyring.get_keyring())
        try:
            if self.account_id == "":
                self.access_token = None
            else:
                self.access_token = keyring.get_password("Maestral", self.account_id)
            return self.access_token
        except KeyringLocked:
            info = "Please make sure that your keyring is unlocked and restart Maestral."
            raise KeyringLocked(info)
github Azure / azure-devops-cli-extension / azure-devops / azext_devops / dev / common / credential_store.py View on Github external
def _initialize_keyring():
        try:
            import keyring
        except ImportError:
            return

        def _only_builtin(backend):
            return (
                backend.__module__.startswith('keyring.backends.') and
                'chain' not in backend.__module__
            )

        keyring.core.init_backend(_only_builtin)
        logger.debug('Keyring backend : %s', keyring.get_keyring())
github priyankcommits / pyfiddleio / pyfiddle_executer_36 / wheel / tool / __init__.py View on Github external
def get_keyring():
    try:
        from ..signatures import keys
        import keyring
        assert keyring.get_keyring().priority
    except (ImportError, AssertionError):
        raise WheelError(
            "Install wheel[signatures] (requires keyring, keyrings.alt, pyxdg) for signatures.")

    return keys.WheelKeys, keyring
github HenriWahl / Nagstamon / Nagstamon / Nagstamon / Config.py View on Github external
# keyring and secretstorage have to be importable
                import keyring, secretstorage
                if ("SecretService") in dir(keyring.backends) and not (keyring.get_keyring() is None):
                    return True
            else:
                # safety first - if not yet available disable it
                #if not self.__dict__.has_key("use_system_keyring"):
                if not 'use_system_keyring' in self.__dict__.keys():
                    self.use_system_keyring = False
                # only import keyring lib if configured to do so
                # necessary to avoid Windows crashes like https://github.com/HenriWahl/Nagstamon/issues/97
                if self.use_system_keyring == True:
                    # hint for packaging: nagstamon.spec always have to match module path
                    # keyring has to be bound to object to be used later
                    import keyring
                    return  not (keyring.get_keyring() is None)
                else:
                    return False
        except:
            import traceback
            traceback.print_exc(file=sys.stdout)
            return False
github joeflack4 / just-a-dash / env / Lib / site-packages / wheel / tool / __init__.py View on Github external
def get_keyring():
    try:
        from ..signatures import keys
        import keyring
        assert keyring.get_keyring().priority
    except (ImportError, AssertionError):
        raise WheelError("Install wheel[signatures] (requires keyring, keyrings.alt, pyxdg) for signatures.")
    return keys.WheelKeys, keyring