本文整理汇总了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
示例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
示例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
示例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
示例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
示例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