本文整理汇总了Python中mc_bin_client.MemcachedClient.sasl_auth_cram_md5方法的典型用法代码示例。如果您正苦于以下问题:Python MemcachedClient.sasl_auth_cram_md5方法的具体用法?Python MemcachedClient.sasl_auth_cram_md5怎么用?Python MemcachedClient.sasl_auth_cram_md5使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mc_bin_client.MemcachedClient
的用法示例。
在下文中一共展示了MemcachedClient.sasl_auth_cram_md5方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_auth
# 需要导入模块: from mc_bin_client import MemcachedClient [as 别名]
# 或者: from mc_bin_client.MemcachedClient import sasl_auth_cram_md5 [as 别名]
def do_auth(self, bucket, password):
self.log.info("Authenticate with {0} to {1}:{2}".format(self.auth_mech,
bucket,
password))
ret = None
nodes = RestConnection(self.master).get_nodes()
for n in nodes:
if n.ip == self.master.ip and n.port == self.master.port:
node = n
client = MemcachedClient(self.master.ip, node.memcached)
try:
if self.auth_mech == "CRAM-MD5":
ret = client.sasl_auth_cram_md5(bucket, password)[2]
elif self.auth_mech == "PLAIN":
ret = client.sasl_auth_plain(bucket, password)[2]
else:
self.fail("Invalid auth mechanism {0}".format(self.auth_mech))
except MemcachedError, e:
ret = e.msg.split(' for vbucket')[0]