当前位置: 首页>>代码示例>>Python>>正文


Python JSONRequests.getresponse方法代码示例

本文整理汇总了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)
     
开发者ID:PerilousApricot,项目名称:CMSYAAT,代码行数:28,代码来源:WorkflowGenerator.py

示例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)
开发者ID:PerilousApricot,项目名称:CMSYAAT,代码行数:14,代码来源:WorkflowGenerator.py

示例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
开发者ID:PerilousApricot,项目名称:CMSYAAT,代码行数:17,代码来源:WorkflowGenerator.py


注:本文中的WMCore.Services.Requests.JSONRequests.getresponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。