本文整理汇总了Python中WMCore.Services.Requests.JSONRequests.getresponse方法的典型用法代码示例。如果您正苦于以下问题:Python JSONRequests.getresponse方法的具体用法?Python JSONRequests.getresponse怎么用?Python JSONRequests.getresponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMCore.Services.Requests.JSONRequests
的用法示例。
在下文中一共展示了JSONRequests.getresponse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: assignRequest
# 需要导入模块: from WMCore.Services.Requests import JSONRequests [as 别名]
# 或者: from WMCore.Services.Requests.JSONRequests import getresponse [as 别名]
def assignRequest(self,url,workflow,team,site,args={}):
params = {"action": "Assign",
"Team"+team: "checked",
"SiteWhitelist": [],
"SiteBlacklist": [],
"MergedLFNBase": "/store/user",
"UnmergedLFNBase": "/store/temp/user",
"MinMergeSize": 1,
"MaxMergeSize": 1,
"MaxMergeEvents": 50000,
#"AcquisitionEra": era,
"maxRSS": 4294967296,
"maxVSize": 4294967296,
"dashboard": "CMSYAATAnalysis",
"checkbox"+workflow: "checked"}
request = JSONRequests(url)
headers = {"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"}
request.post("/reqmgr/assign/handleAssignmentPage", params, headers)
(data, status, reason, _) = request.getresponse()
if status != 200:
self.debugHttpError(data, status, reason)
raise RuntimeError, "POST failed with code %s" % status
self.logger.info("Assigned the workflow %s" % workflow)
示例2: approveRequest
# 需要导入模块: from WMCore.Services.Requests import JSONRequests [as 别名]
# 或者: from WMCore.Services.Requests.JSONRequests import getresponse [as 别名]
def approveRequest(self, url,workflow):
params = {"requestName": workflow, "status": "assignment-approved"}
request = JSONRequests(url)
headers = {"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"}
request.put("/reqmgr/reqMgr/request", params, headers)
(data, status, reason, _) = request.getresponse()
if status != 200:
self.debugHttpError(data, status, reason)
raise RuntimeError, "PUT failed with code %s" % status
self.logger.info("Approved the workflow %s" % workflow)
示例3: makeRequest
# 需要导入模块: from WMCore.Services.Requests import JSONRequests [as 别名]
# 或者: from WMCore.Services.Requests.JSONRequests import getresponse [as 别名]
def makeRequest(self, url, params):
request = JSONRequests(url)
headers = {"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"}
request.post("/reqmgr/create/makeSchema", params, headers)
(data, status, reason, _) = request.getresponse()
if status != 303:
self.debugHttpError(data, status, reason)
raise RuntimeError, "POST failed with code %s" % status
workflow=data.split("'")[1].split('/')[-1]
self.logger.info('Injected workflow:',workflow,'into',url)
return workflow