本文整理汇总了Python中gi.repository.GnomeKeyring.list_keyring_names_sync方法的典型用法代码示例。如果您正苦于以下问题:Python GnomeKeyring.list_keyring_names_sync方法的具体用法?Python GnomeKeyring.list_keyring_names_sync怎么用?Python GnomeKeyring.list_keyring_names_sync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.GnomeKeyring
的用法示例。
在下文中一共展示了GnomeKeyring.list_keyring_names_sync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository import GnomeKeyring [as 别名]
# 或者: from gi.repository.GnomeKeyring import list_keyring_names_sync [as 别名]
def __init__(self):
self.loginDetails = False
if gk.is_available() is True:
if "Gusic" in gk.list_keyring_names_sync()[1]:
self.keyring = gk.list_item_ids_sync("Gusic")[1]
self.loginDetails = self._get_first_key("Gusic")
else:
gk.create_sync("Gusic", "Gusic")
示例2: __init__
# 需要导入模块: from gi.repository import GnomeKeyring [as 别名]
# 或者: from gi.repository.GnomeKeyring import list_keyring_names_sync [as 别名]
def __init__(self):
self._protocol = "network"
self._key = gk.ItemType.NETWORK_PASSWORD
if not gk.is_available():
raise KeyringException("The Gnome keyring is not available")
logger.debug("GnomeKeyring is available")
self.loaded = False
self.lock = threading.RLock()
if not self.loaded:
(result, keyring_names) = gk.list_keyring_names_sync()
if self._KEYRING_NAME not in keyring_names:
logger.error("Error getting the gnome keyring. We'll try to create it: %s")
logger.debug("Creating keyring " + self._KEYRING_NAME)
gk.create_sync(self._KEYRING_NAME, None)
self.loaded = True
示例3: len
# 需要导入模块: from gi.repository import GnomeKeyring [as 别名]
# 或者: from gi.repository.GnomeKeyring import list_keyring_names_sync [as 别名]
import sys
from gi.repository import GnomeKeyring as gk
if len(sys.argv) < 3:
print >> sys.stderr, "invalid arguments\n python gnomekeyring.py keyring itemname"
exit(1)
ringname = sys.argv[1]
keyname = sys.argv[2]
(result, keyrings) = gk.list_keyring_names_sync()
if not ringname in keyrings:
print >> sys.stderr, "keyring '%s' not found" % ringname
exit(2)
result = gk.unlock_sync(ringname, None)
if not result == gk.Result.OK:
print >> sys.stderr, "keyring '%s' is locked" % ringname
exit(3)
(result, ids) = gk.list_item_ids_sync(ringname)
for id in ids:
(result, info) = gk.item_get_info_sync(ringname, id)
if info.get_display_name() == keyname:
print info.get_secret()
exit(0)
print >> sys.stderr, "keyname '%s' in '%s' not found" % (keyname, ringname)
exit(4)