本文整理汇总了Python中service.Service.request_json方法的典型用法代码示例。如果您正苦于以下问题:Python Service.request_json方法的具体用法?Python Service.request_json怎么用?Python Service.request_json使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类service.Service
的用法示例。
在下文中一共展示了Service.request_json方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: request
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import request_json [as 别名]
def request(self, uri):
"""Build the request to run against drupal
request(project uri)
Values and structure returned:
{username: {uid:int,
repo_id:int,
access:boolean,
branch_create:boolean,
branch_update:boolean,
branch_delete:boolean,
tag_create:boolean,
tag_update:boolean,
tag_delete:boolean,
per_label:list,
name:str,
pass:md5,
ssh_keys: { key_name:fingerprint }
}
}"""
service = Service(AuthProtocol('vcs-auth-data'))
service.request_json({"project_uri":self.projectname(uri)})
def NoDataHandler(fail):
fail.trap(ConchError)
message = fail.value.value
log.err(message)
# Return a stub auth_service object
return {"users":{}, "repo_id":None}
service.addErrback(NoDataHandler)
return service.deferred
示例2: fetchHash
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import request_json [as 别名]
def fetchHash(credentials):
service = Service(AuthProtocol('drupalorg-vcs-auth-fetch-user-hash'))
service.request_json({"username":credentials.username})
def auth_callback(result):
if result:
self.meta.password = DrupalHash(result, credentials.password).get_hash()
return checkAuth(credentials)
service.addCallback(auth_callback)
return service.deferred