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