本文整理汇总了Python中service.Service.request_bool方法的典型用法代码示例。如果您正苦于以下问题:Python Service.request_bool方法的具体用法?Python Service.request_bool怎么用?Python Service.request_bool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类service.Service
的用法示例。
在下文中一共展示了Service.request_bool方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: requestAvatarId
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import request_bool [as 别名]
def requestAvatarId(self, credentials):
key = Key.fromString(credentials.blob)
fingerprint = key.fingerprint().replace(':', '')
self.meta.fingerprint = fingerprint
if (credentials.username == 'git'):
# Todo, maybe verify the key with a process protocol call
# (drush or http)
def success():
return credentials.username
d = defer.maybeDeferred(success)
d.addCallback(self.verify, credentials, key)
return d
else:
""" If a user specified a non-git username, check that the user's key matches their username
so that we can request a password if it does not."""
service = Service(AuthProtocol('drupalorg-ssh-user-key'))
service.request_bool({"username":credentials.username},
{"fingerprint":fingerprint})
def auth_callback(result):
if result:
return credentials.username
else:
return Failure(UnauthorizedLogin(credentials.username))
service.addCallback(auth_callback)
service.addCallback(self.verify, credentials, key)
return service.deferred
示例2: checkAuth
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import request_bool [as 别名]
def checkAuth(credentials):
service = Service(AuthProtocol('drupalorg-vcs-auth-check-user-pass'))
service.request_bool({"username":credentials.username},
{"password":self.meta.password})
def auth_callback(result):
if result:
return credentials.username
else:
return Failure(UnauthorizedLogin(credentials.username))
service.addCallback(auth_callback)
return service.deferred
示例3: identify
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import request_bool [as 别名]
def identify(self,credentials):
passwd = hashlib.md5(credentials.password).hexdigest()
service = Service(AuthProtocol('drupalorg-vcs-auth-check-user-pass'))
service.request_bool({"username":credentials.username},
{"password":passwd})
def auth_callback(result):
if result:
return credentials.username
else:
return Failure(UnauthorizedLogin(credentials.username))
service.addCallback(auth_callback)
return service.deferred