当前位置: 首页>>代码示例>>Python>>正文


Python Secret.password_store_sync方法代码示例

本文整理汇总了Python中gi.repository.Secret.password_store_sync方法的典型用法代码示例。如果您正苦于以下问题:Python Secret.password_store_sync方法的具体用法?Python Secret.password_store_sync怎么用?Python Secret.password_store_sync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.Secret的用法示例。


在下文中一共展示了Secret.password_store_sync方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _update_lastfm_settings

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_store_sync [as 别名]
 def _update_lastfm_settings(self, sync=False):
     """
         Update lastfm settings
         @param sync as bool
     """
     try:
         if Lp().lastfm is not None and Secret is not None:
             schema = Secret.Schema.new("org.gnome.Lollypop",
                                        Secret.SchemaFlags.NONE,
                                        SecretSchema)
             Secret.password_store_sync(schema, SecretAttributes,
                                        Secret.COLLECTION_DEFAULT,
                                        "org.gnome.Lollypop"
                                        ".lastfm.login %s" %
                                        self.__login.get_text(),
                                        self.__password.get_text(),
                                        None)
             Lp().settings.set_value('lastfm-login',
                                     GLib.Variant('s',
                                                  self.__login.get_text()))
             if sync:
                 Lp().lastfm.connect_sync(self.__password.get_text())
             else:
                 Lp().lastfm.connect(self.__password.get_text())
     except Exception as e:
         print("Settings::_update_lastfm_settings(): %s" % e)
开发者ID:TainakaDrums,项目名称:lollypop,代码行数:28,代码来源:settings.py

示例2: insert

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_store_sync [as 别名]
    def insert(secret_id, provider, username, token):
        """
        Save a secret OTP token.

        :param secret_id: The secret ID associated to the OTP token
        :param provider: the provider name
        :param username: the username
        :param token: the secret OTP token.


        """
        schema = Keyring.get_default().schema

        data = {
            "id": str(secret_id),
            "name": str(username),
        }
        Secret.password_store_sync(
            schema,
            data,
            Secret.COLLECTION_DEFAULT,
            "{provider} OTP ({username})".format(
                provider=provider, username=username),
            token,
            None
        )
开发者ID:bil-elmoussaoui,项目名称:Gnome-TwoFactorAuth,代码行数:28,代码来源:keyring.py

示例3: set_account_password

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_store_sync [as 别名]
def set_account_password(email, password):
    attrs = {"email": email}
    if password:
        Secret.password_store_sync(_ACCOUNT_SCHEMA, attrs, Secret.COLLECTION_DEFAULT,
                                    "Pandora Account", password, None)
    else:
        Secret.password_clear_sync(_ACCOUNT_SCHEMA, attrs, None)
开发者ID:NightBuilder,项目名称:pithos,代码行数:9,代码来源:util.py

示例4: store_password

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_store_sync [as 别名]
 def store_password(self, scheme, host, username, password):
     """Return the password of [email protected]"""
     template = dict(zip(self.category, (scheme, host, username)))
     self.clear_password(scheme, host, username)
     try:
         Secret.password_store_sync(
             self.schema, template, Secret.COLLECTION_DEFAULT, host,
             password, None)
     except Secret.SECRET_ERROR_PROTOCOL:
         pass
开发者ID:benfitzpatrick,项目名称:rose,代码行数:12,代码来源:ws_client_auth.py

示例5: testValueGet

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_store_sync [as 别名]
	def testValueGet(self):
		Secret.password_store_sync(EXAMPLE_SCHEMA, attributes, Secret.COLLECTION_DEFAULT,
		                           'the label', 'the password', None)

		service = SecretUnstable.Service.get_sync(SecretUnstable.ServiceFlags.NONE, None)
		items = service.search_sync(EXAMPLE_SCHEMA, { 'even': 'true' },
		                                   SecretUnstable.SearchFlags.ALL | SecretUnstable.SearchFlags.LOAD_SECRETS,
		                                   None)

		item = items[0]
		item_secret = item.get_secret()
		self.assertEqual(item_secret.get(), "the password")
开发者ID:Arkhont,项目名称:libsecret,代码行数:14,代码来源:test-unstable.py

示例6: setTokens

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_store_sync [as 别名]
    def setTokens(self, user, access_token, refresh_token):
        attributes = {
                         "user": user,
                         "scope": self.scope,
                     }

        Secret.password_store_sync(self.TOKEN_SCHEMA, attributes,
                          Secret.COLLECTION_DEFAULT,
                          "Mail access to %s for %s" % (self.scope, user),
                          self.encodeTokens(access_token, refresh_token),
                          None
                     )
开发者ID:AmmarAhmed01,项目名称:gnome-gmail,代码行数:14,代码来源:gnomegmail.py

示例7: store

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_store_sync [as 别名]
def store():

    attributes = get_attributes()
    if 'password' in attributes:
        password = attributes['password']
        del attributes['password']
    else:
        sys.exit(1)
    Secret.password_store_sync(
            GIT_CREDENTIALS_SCHEMA,
            attributes,
            Secret.COLLECTION_DEFAULT,
            "%s://%[email protected]%s" %(attributes['protocol'], attributes['username'], attributes['host'] ),
            password,
            None
            )
开发者ID:timhughes,项目名称:git-credential-libsecret,代码行数:18,代码来源:git-credential-libsecret.py

示例8: set_account_password

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_store_sync [as 别名]
def set_account_password(email, password, previous_email=None):
    if previous_email and previous_email != email:
        if not _clear_account_password(previous_email):
            logging.warning('Failed to clear previous account')

    if not password:
        return _clear_account_password(email)

    attrs = {"email": email}
    if password == get_account_password(email):
        logging.debug('Password unchanged')
        return False

    Secret.password_store_sync(_ACCOUNT_SCHEMA, attrs, Secret.COLLECTION_DEFAULT,
                                "Pandora Account", password, None)
    return True
开发者ID:evilwordsoup,项目名称:pithos,代码行数:18,代码来源:util.py

示例9: _update_lastfm_settings

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_store_sync [as 别名]
 def _update_lastfm_settings(self, sync=False):
     if Lp.lastfm is not None and Secret is not None:
         schema = Secret.Schema.new("org.gnome.Lollypop",
                                    Secret.SchemaFlags.NONE,
                                    SecretSchema)
         Secret.password_store_sync(schema, SecretAttributes,
                                    Secret.COLLECTION_DEFAULT,
                                    "org.gnome.Lollypop.lastfm.login %s" %
                                    self._login.get_text(),
                                    self._password.get_text(),
                                    None)
         Lp.settings.set_value('lastfm-login',
                               GLib.Variant('s', self._login.get_text()))
         if sync:
             Lp.lastfm.connect_sync(self._password.get_text())
         else:
             Lp.lastfm.connect(self._password.get_text())
开发者ID:yoseforb,项目名称:lollypop,代码行数:19,代码来源:settings.py

示例10: testSynchronous

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_store_sync [as 别名]
	def testSynchronous(self):
		attributes = { "number": "9", "string": "nine", "even": "false" }

		password = Secret.password_lookup_sync(STORE_SCHEMA, attributes, None)
		self.assertEqual(None, password)

		stored = Secret.password_store_sync(STORE_SCHEMA, attributes, Secret.COLLECTION_DEFAULT,
		                                    "The number nine", "999", None)
		self.assertEqual(True, stored);

		password = Secret.password_lookup_sync(STORE_SCHEMA, attributes, None)
		self.assertEqual("999", password)
开发者ID:Pusenka,项目名称:libsecret,代码行数:14,代码来源:test-store-password.py


注:本文中的gi.repository.Secret.password_store_sync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。