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


Python MyRequests.get方法代码示例

本文整理汇总了Python中MyRequestsClass.MyRequests.get方法的典型用法代码示例。如果您正苦于以下问题:Python MyRequests.get方法的具体用法?Python MyRequests.get怎么用?Python MyRequests.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MyRequestsClass.MyRequests的用法示例。


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

示例1: list_machines

# 需要导入模块: from MyRequestsClass import MyRequests [as 别名]
# 或者: from MyRequestsClass.MyRequests import get [as 别名]
def list_machines(uri, cloud_id, cookie=None, csrf=None):
    req = MyRequests(uri=uri + "/clouds/" + cloud_id + "/machines", cookie=cookie, csrf=csrf)
    response = req.get()
    assert response.ok, u"\nGot %d Response Status: %s \n%s" % (response.status_code, response.reason, response.text)
    try:
        params = response.json()
        return params
    except Exception as e:
        assert False, u"Exception: %s" % e
开发者ID:mario-olivarez,项目名称:mist.io,代码行数:11,代码来源:machines.py

示例2: list_machines

# 需要导入模块: from MyRequestsClass import MyRequests [as 别名]
# 或者: from MyRequestsClass.MyRequests import get [as 别名]
def list_machines(uri, backend_id, cookie=None):
    req = MyRequests(uri=uri+'/backends/'+backend_id+"/machines", cookie=cookie)
    response = req.get()
    assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)
    try:
        params = response.json()
        return params
    except Exception as e:
        assert False, u'Exception: %s' % e
开发者ID:a42,项目名称:mist.io,代码行数:11,代码来源:machines.py

示例3: list_clouds

# 需要导入模块: from MyRequestsClass import MyRequests [as 别名]
# 或者: from MyRequestsClass.MyRequests import get [as 别名]
def list_clouds(uri, cookie=None, csrf=None):
    req = MyRequests(uri=uri + '/clouds', cookie=cookie, csrf=csrf)
    response = req.get()
    assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)

    try:
        params = response.json()
        return params
    except Exception as e:
        assert False, u'Exception: %s' %e
开发者ID:mario-olivarez,项目名称:mist.io,代码行数:12,代码来源:clouds.py

示例4: get_public_key

# 需要导入模块: from MyRequestsClass import MyRequests [as 别名]
# 或者: from MyRequestsClass.MyRequests import get [as 别名]
def get_public_key(uri, key_id, cookie=None):
    req = MyRequests(uri=uri+"/keys/"+key_id+"?action=public", cookie=cookie)
    response = req.get()
    assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)

    try:
        params = response.json()
        return params
    except Exception as e:
        print response.text
        assert False, u'Exception: %s' %e
开发者ID:a42,项目名称:mist.io,代码行数:13,代码来源:keypairs.py

示例5: supported_providers

# 需要导入模块: from MyRequestsClass import MyRequests [as 别名]
# 或者: from MyRequestsClass.MyRequests import get [as 别名]
def supported_providers(uri, cookie=None, csrf=None):
    req = MyRequests(uri=uri+'/providers', cookie=cookie, csrf=csrf)
    response = req.get()
    assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)

    try:
        params = response.json()
    except Exception as e:
        assert False, u'Exception: %s' %e

    SUPPORTED_PROVIDERS = params['supported_providers']
    print '\nSupported providers:'
    return SUPPORTED_PROVIDERS
开发者ID:mario-olivarez,项目名称:mist.io,代码行数:15,代码来源:clouds.py

示例6: list_images

# 需要导入模块: from MyRequestsClass import MyRequests [as 别名]
# 或者: from MyRequestsClass.MyRequests import get [as 别名]
def list_images(uri, backend_id, search_term=None, cookie=None):
    payload = {
        'search_term': search_term
    }
    if not search_term:
        req = MyRequests(uri=uri+"/backends/"+backend_id+"/images", cookie=cookie)
        response = req.post()
    else:
        req = MyRequests(uri=uri+"/backends/"+backend_id+"/images", data=json.dumps(payload), cookie=cookie)
        response = req.get()
    assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)

    try:
        params = response.json()
        return params
    except Exception as e:
        assert False, u'Exception: %s' % e
开发者ID:a42,项目名称:mist.io,代码行数:19,代码来源:backends.py


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