本文整理汇总了Python中astakosclient.AstakosClient.get_uuids方法的典型用法代码示例。如果您正苦于以下问题:Python AstakosClient.get_uuids方法的具体用法?Python AstakosClient.get_uuids怎么用?Python AstakosClient.get_uuids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类astakosclient.AstakosClient
的用法示例。
在下文中一共展示了AstakosClient.get_uuids方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_invalid_token
# 需要导入模块: from astakosclient import AstakosClient [as 别名]
# 或者: from astakosclient.AstakosClient import get_uuids [as 别名]
def test_invalid_token(self):
"""Test the response we get for invalid token (using pool)"""
global user, auth_url
token = "skaksaFlBl+fasFdaf24sx"
try:
client = AstakosClient(token, auth_url)
client.get_uuids([user['name']])
except Unauthorized:
pass
except Exception:
self.fail("Should have returned 401 (Invalid X-Auth-Token)")
else:
self.fail("Should have returned 401 (Invalid X-Auth-Token)")
示例2: retrieve_uuids
# 需要导入模块: from astakosclient import AstakosClient [as 别名]
# 或者: from astakosclient.AstakosClient import get_uuids [as 别名]
def retrieve_uuids(token, displaynames, return_dict=False, fail_silently=True):
astakos = AstakosClient(token, ASTAKOS_AUTH_URL, retry=2, use_pool=True, logger=logger)
catalog = astakos.get_uuids(displaynames) or {}
missing = list(set(displaynames) - set(catalog))
if missing and not fail_silently:
raise ItemNotExists("Unknown uuids: %s" % ", ".join(missing))
return catalog if return_dict else [catalog.get(i) for i in displaynames]
示例3: test_get_uuid
# 需要导入模块: from astakosclient import AstakosClient [as 别名]
# 或者: from astakosclient.AstakosClient import get_uuids [as 别名]
def test_get_uuid(self):
"""Test get_uuid"""
global token, user, auth_url
try:
client = AstakosClient(token['id'], auth_url, retry=1)
catalog = client.get_uuids([user['name']])
except:
self.fail("Shouldn't raise an Exception")
self.assertEqual(catalog[user['name']], user['id'])