How to use the keyring.backends.OS_X.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 artisan-roaster-scope / artisan / src / plus / connection.py View on Github external
def setKeyring():
    try:
        #HACK set keyring backend explicitly
        if platform.system().startswith("Windows"):
            import keyring # @Reimport
            keyring.set_keyring(keyring.backends.Windows.WinVaultKeyring())   # @UndefinedVariable                  
        elif platform.system() == 'Darwin':
            import keyring # @Reimport
            keyring.set_keyring(keyring.backends.OS_X.Keyring())
        else: # Linux
            try:
#                import os
#                config.logger.debug("keyring dbus path: %s",os.environ['DBUS_SESSION_BUS_ADDRESS'])
                
#                import keyring # @Reimport
#                
#                # test if secretstorage dbus is working
#                import secretstorage  # @Reimport @UnresolvedImport
#                bus = secretstorage.dbus_init()
#                _ = list(secretstorage.get_all_collections(bus))
#                # if yes, import it
#                import keyring.backends.SecretService # @Reimport
#                ss_keyring = keyring.backends.SecretService.Keyring()
#                if ss_keyring.priority:
#                    import keyring # @Reimport
github SamSchott / maestral-dropbox / maestral / sync / oauth.py View on Github external
# maestral modules
from maestral.sync.constants import IS_MACOS_BUNDLE
from maestral.config.main import CONF, SUBFOLDER
from maestral.config.base import get_conf_path
from maestral.sync.oauth_implicit import DropboxOAuth2FlowImplicit
from maestral.sync.errors import CONNECTION_ERRORS, DropboxAuthError

logger = logging.getLogger(__name__)

APP_KEY = "2jmbq42w7vof78h"


if IS_MACOS_BUNDLE:
    import keyring.backends.OS_X
    keyring.set_keyring(keyring.backends.OS_X.Keyring())
else:
    # get preferred keyring backends for platform, excluding the chainer backend
    all_keyrings = keyring.backend.get_all_keyring()
    preferred_kreyrings = [k for k in all_keyrings if not isinstance(k, keyring.backends.chainer.ChainerBackend)]

    keyring.set_keyring(max(preferred_kreyrings, key=lambda x: x.priority))


class OAuth2Session(object):
    """
    OAuth2Session provides OAuth2 login and token store.
    """

    TOKEN_FILE = osp.join(get_conf_path(SUBFOLDER), "o2_store.txt")  # before v0.2.0
    oAuth2FlowResult = None
github EinApfelBaum / otr-verwaltung3p / otrverwaltung3p / config.py View on Github external
from base64 import b64decode, b64encode
import json
import logging
import os.path
import sys

try:
    import keyring
    keyring_available = True
    if sys.platform == 'win32':
        from keyring.backends import Windows
        keyring.set_keyring(Windows.WinVaultKeyring())
    elif sys.platform == 'darwin':
        from keyring.backends import OS_X
        keyring.set_keyring(keyring.backends.OS_X.Keyring())
except ImportError:
    keyring = None
    Windows = None
    OS_X = None
    keyring_available = False

from otrverwaltung3p import path as otrvpath
from otrverwaltung3p.libs import pyaes
from otrverwaltung3p import fileoperations


class Config:
    """ Loads and saves configuration fields from/to file. """

    def __init__(self, config_file, fields):
        """ """
github SamSchott / maestral-dropbox / maestral / gui / main.py View on Github external
from maestral.gui.utils import (
    UserDialog,
    MaestralBackgroundTask,
    MaestralBackgroundTaskProgressDialog,
    elide_string,
)

logger = logging.getLogger(__name__)

CONFIG_NAME = os.environ.get("MAESTRAL_CONFIG", "maestral")


# TODO: move this to sync.utils
if IS_MACOS_BUNDLE:
    import keyring.backends.OS_X
    keyring.set_keyring(keyring.backends.OS_X.Keyring())
else:
    # get preferred keyring backends for platform, excluding the chainer backend
    all_keyrings = keyring.backend.get_all_keyring()
    preferred_kreyrings = [k for k in all_keyrings if not isinstance(k, keyring.backends.chainer.ChainerBackend)]

    keyring.set_keyring(max(preferred_kreyrings, key=lambda x: x.priority))


# noinspection PyTypeChecker,PyArgumentList
class MaestralGuiApp(QtWidgets.QSystemTrayIcon):
    """A Qt GUI for the Maestral daemon."""

    mdbx = None
    _started = False

    _context_menu_visible = False