本文整理汇总了Python中gi.repository.Secret.password_lookup_sync方法的典型用法代码示例。如果您正苦于以下问题:Python Secret.password_lookup_sync方法的具体用法?Python Secret.password_lookup_sync怎么用?Python Secret.password_lookup_sync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Secret
的用法示例。
在下文中一共展示了Secret.password_lookup_sync方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testSynchronous
# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup_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)
示例2: testSyncNotFound
# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup_sync [as 别名]
def testSyncNotFound(self):
attributes = { "number": "11", "string": "one", "even": "true" }
password = Secret.password_lookup_sync(STORE_SCHEMA, attributes, None)
self.assertEqual(None, password)
deleted = Secret.password_remove_sync(STORE_SCHEMA, attributes, None)
self.assertEqual(False, deleted)
示例3: testSynchronous
# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup_sync [as 别名]
def testSynchronous(self):
attributes = { "number": "1", "string": "one", "even": "false" }
password = Secret.password_lookup_sync(STORE_SCHEMA, attributes, None)
self.assertEqual("111", password)
deleted = Secret.password_remove_sync(STORE_SCHEMA, attributes, None)
self.assertEqual(True, deleted)
示例4: find_password
# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup_sync [as 别名]
def find_password(self, scheme, host, username):
"""Return the password of [email protected]"""
template = dict(zip(self.category, (scheme, host, username)))
try:
password = Secret.password_lookup_sync(self.schema, template, None)
except Secret.SECRET_ERROR_PROTOCOL:
return
return password
示例5: testAsynchronous
# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup_sync [as 别名]
def testAsynchronous(self):
attributes = { "number": "888", "string": "eight", "even": "true" }
password = Secret.password_lookup_sync(STORE_SCHEMA, attributes, None)
self.assertEqual(None, password);
loop = GLib.MainLoop(None, False)
def on_result_ready(source, result, unused):
loop.quit()
stored = Secret.password_store_finish(result)
self.assertEquals(True, stored)
Secret.password_store(STORE_SCHEMA, attributes, None, "The number eight", "888",
None, on_result_ready, None)
loop.run()
password = Secret.password_lookup_sync(STORE_SCHEMA, attributes, None)
self.assertEqual("888", password)
示例6: get_by_id
# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup_sync [as 别名]
def get_by_id(secret_id):
"""
Return the OTP token based on a secret ID.
:param secret_id: the secret ID associated to an OTP token
:type secret_id: str
:return: the secret OTP token.
"""
schema = Keyring.get_default().schema
password = Secret.password_lookup_sync(
schema, {"id": str(secret_id)}, None)
return password
示例7: getTokens
# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup_sync [as 别名]
def getTokens(self, user):
attributes = {
"user": user,
"scope": self.scope,
}
password = Secret.password_lookup_sync(self.TOKEN_SCHEMA,
attributes, None)
if password:
return self.decodeTokens(password)
else:
return (None, None)
示例8: get
# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup_sync [as 别名]
def get():
attributes = get_attributes()
if 'password' in attributes:
del attributes['password']
password = Secret.password_lookup_sync(
GIT_CREDENTIALS_SCHEMA,
attributes,
None
)
if password:
secret_item = find_secret_item(attributes)
print('protocol=%s' % secret_item['protocol'])
print('host=%s' % secret_item['host'])
print('username=%s' % secret_item['username'])
print('password=%s' % secret_item['password'])
示例9: testSyncNotFound
# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup_sync [as 别名]
def testSyncNotFound(self):
password = Secret.password_lookup_sync (STORE_SCHEMA, { "number": "5", "even": "true" }, None)
self.assertEqual(None, password)
示例10: testSynchronous
# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup_sync [as 别名]
def testSynchronous(self):
password = Secret.password_lookup_sync (STORE_SCHEMA, { "number": "1", "even": "false" }, None)
self.assertEqual("111", password)
示例11: get_account_password
# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup_sync [as 别名]
def get_account_password(email):
return Secret.password_lookup_sync(_ACCOUNT_SCHEMA, {"email": email}, None) or ''