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


Python restclient.get函数代码示例

本文整理汇总了Python中restclient.get函数的典型用法代码示例。如果您正苦于以下问题:Python get函数的具体用法?Python get怎么用?Python get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: runcommand

def runcommand(case,sso_cookie):
    start_=datetime.utcnow()
    resp = None
    if case.method == 'get':
        if case.args =={}:
            resp = restclient.get(case.url, sso_cookie, case.bodyArgs, case.headers)
        else:
            resp = restclient.get(case.url, sso_cookie, case.args, case.headers)
    elif case.method == 'post':
        resp = postcase(case, sso_cookie)
    elif case.method == 'put':
        resp = putcase(case, sso_cookie)
    elif case.method == 'delete':
        resp = deletecase(case, sso_cookie)
    else:
        raise Exception('不支持的方法 %s。只支持get, post, put' % case.method)

    #强制保留2位
    end_=datetime.utcnow()
    c=(end_-start_)
    #microseconds 微秒 :1000微秒=1毫秒
    runtime=int(c.microseconds/1000)

   # interface_runtime=(float('%.2lf'%((time.time()-interfaces_runstarttime)*1000)))

    return resp,runtime
开发者ID:WhatAJerkIam,项目名称:rath,代码行数:26,代码来源:runner.py

示例2: testGetByUpdateTime

 def testGetByUpdateTime(self):
     print "HTTP GET: getting elements by update time"
     minUpdateTime = 0
     maxUpdateTime = int(datetime.datetime.utcnow().strftime('%s'))*1000        
     params = '?minUpdateTime=' + str(minUpdateTime) + "&maxUpdateTime=" + str(maxUpdateTime)
     response = restclient.get(serviceUrl=serviceUrl, params=params)
     print response.code
     assert response.code == 200, "can't get element by name: " + name
开发者ID:HausMa,项目名称:genie,代码行数:8,代码来源:clusterConfigTest.py

示例3: testGetErr

 def testGetErr(self):
     print "HTTP GET: wrong params - no such id exists"
     params = '?id=does_not_exist'
     try:
         response = restclient.get(serviceUrl=serviceUrl, params=params)
         print response.read()
         assert False, "received unexpected successful response"
     except urllib2.HTTPError, e:
         print e.read()
         assert e.code == 404, "received unexpected unsuccessful response"
开发者ID:TheSalimbo,项目名称:genie,代码行数:10,代码来源:hiveConfigTest.py

示例4: testGetForFakeStatus

 def testGetForFakeStatus(self):
     print "HTTP GET - test for status DUMMY: "
     params = "?status=DUMMY&limit=3"
     try:
         response = restclient.get(serviceUrl=serviceUrl, params=params)
         print response.read()
         assert False, "received unexpected successful response"
     except urllib2.HTTPError, e:
         print e.read()
         assert e.code == 400, "received unexpected unsuccessful response"
开发者ID:bradau,项目名称:genie,代码行数:10,代码来源:jobInfoGetTests.py

示例5: testNoSuchPage

 def testNoSuchPage(self):           
     print "HTTP GET: no such page"
     params = '?page=1000'
     try:
         response = restclient.get(serviceUrl=serviceUrl, params=params)
         print response.read()
         assert False, "received unexpected successful response"
     except urllib2.HTTPError, e:
         print e.read()
         assert e.code == 404, "received unexpected unsuccessful response"
开发者ID:HausMa,项目名称:genie,代码行数:10,代码来源:clusterConfigTest.py

示例6: testGetForFakeClusterId

 def testGetForFakeClusterId(self):
     print "HTTP GET - test for clusterId DUMMY: "
     params = '?clusterId=DUMMY&limit=3'
     try:
         response = restclient.get(serviceUrl=serviceUrl, params=params)
         print response.read()
         assert False, "received unexpected successful response"
     except urllib2.HTTPError, e:
         print e.read()
         assert e.code == 404, "received unexpected unsuccessful response"
开发者ID:AlanLiu-AI,项目名称:genie,代码行数:10,代码来源:jobInfoGetTests.py

示例7: testGetBadStatus

 def testGetBadStatus(self):
     print "HTTP GET: bad status"
     params = '?status=FOO'
     try:
         response = restclient.get(serviceUrl=serviceUrl, params=params)
         print response.read()
         assert False, "received unexpected successful response"
     except urllib2.HTTPError, e:
         print e.read()
         assert e.code == 400, "received unexpected unsuccessful response"
开发者ID:HausMa,项目名称:genie,代码行数:10,代码来源:clusterConfigTest.py

示例8: testNoSuchClusterByUpdateTime

 def testNoSuchClusterByUpdateTime(self):
     print "HTTP GET: no such cluster"
     params = '?maxUpdateTime=0'
     try:
         response = restclient.get(serviceUrl=serviceUrl, params=params)
         print response.read()
         assert False, "received unexpected successful response"
     except urllib2.HTTPError, e:
         print e.read()
         assert e.code == 404, "received unexpected unsuccessful response"
开发者ID:HausMa,项目名称:genie,代码行数:10,代码来源:clusterConfigTest.py

示例9: testNoSuchClusterByConfig

 def testNoSuchClusterByConfig(self):
     print "HTTP GET: no such cluster"
     params = '?name='+name+'&unitTest=false'
     try:
         response = restclient.get(serviceUrl=serviceUrl, params=params)
         print response.read()
         assert False, "received unexpected successful response"
     except urllib2.HTTPError, e:
         print e.read()
         assert e.code == 404, "received unexpected unsuccessful response"
开发者ID:HausMa,项目名称:genie,代码行数:10,代码来源:clusterConfigTest.py

示例10: testGetForFakeUser

 def testGetForFakeUser(self):
     print "HTTP GET - test for user DUMMY: "
     params = '?userName=does_not_exist'
     try:
         response = restclient.get(serviceUrl=serviceUrl, params=params)
         print response.read()
         assert False, "received unexpected successful response"
     except urllib2.HTTPError, e:
         print e.read()
         assert e.code == 404, "received unexpected unsuccessful response"
开发者ID:AlanLiu-AI,项目名称:genie,代码行数:10,代码来源:jobInfoGetTests.py

示例11: runlogout

def runlogout(file, case, sso_cookie):
    try:
        resp = restclient.get(case.url, sso_cookie, case.args)
        logger.debug(resp)

        checkStatusExpect(case, resp)

        logger.info('退出成功。')
        return True
    except Exception as msg:
        logger.error('case[%s] failed while logout with [%s].' % (case.id, msg))
        return False
开发者ID:WhatAJerkIam,项目名称:rath,代码行数:12,代码来源:runner.py

示例12: testGetByScheduleAndStatus

 def testGetByScheduleAndStatus(self):
     print "HTTP GET: getting elements by schedule and status"
     params = '?bonus=false&status=UP'
     response = restclient.get(serviceUrl=serviceUrl, params=params)
     print response.code
     assert response.code == 200, "can't get element by schedule and status"
开发者ID:HausMa,项目名称:genie,代码行数:6,代码来源:clusterConfigTest.py

示例13: testHadoopRequest

 def testHadoopRequest(self):
     print "HTTP GET: test=false with jobType=hadoop"
     params = '?jobType=hadoop&test=false'
     response = restclient.get(serviceUrl=serviceUrl, params=params)
     print response.code
     assert response.code == 200, "can't get element by configuration"
开发者ID:HausMa,项目名称:genie,代码行数:6,代码来源:clusterConfigTest.py

示例14: testGetByJobTypeAndConfig

 def testGetByJobTypeAndConfig(self):
     print "HTTP GET: getting cluster with unitTest=true and jobType=hive"    
     params = '?jobType=hive&unitTest=true'
     response = restclient.get(serviceUrl=serviceUrl, params=params)
     print response.code
     assert response.code == 200, "can't get element by configuration"
开发者ID:HausMa,项目名称:genie,代码行数:6,代码来源:clusterConfigTest.py

示例15: testGetByUser

 def testGetByUser(self):
     print "HTTP GET - running GET for user"
     params = '?userName=' + user + '&limit=3'
     response = restclient.get(serviceUrl=serviceUrl, params=params)
     print response.code
     assert response.code == 200, "can't get elements by user"
开发者ID:AlanLiu-AI,项目名称:genie,代码行数:6,代码来源:jobInfoGetTests.py


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