本文整理匯總了Python中openstack.utils.HandlePycurl.getData方法的典型用法代碼示例。如果您正苦於以下問題:Python HandlePycurl.getData方法的具體用法?Python HandlePycurl.getData怎麽用?Python HandlePycurl.getData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類openstack.utils.HandlePycurl
的用法示例。
在下文中一共展示了HandlePycurl.getData方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: v2_validateToken
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import getData [as 別名]
def v2_validateToken(request):
""" Validates a token and confirms that it belongs to a specified tenant.
Method:GET
URI:/v2.0/tokens/{tokenId}{?belongsTo}
"""
req_params = {
"token_id": request.GET.get("token_id"),
"remotehost": request.GET.get("remotehost"),
}
head = [
"X-Auth-Token: %s" % req_params.get("token_id"),
"Content-Type: application/json",
"Accept: application/json"
]
parms = {
'servername': req_params.get("remotehost"),
'port': 8774,
'uri': '/v2.0/tokens/%(tokenId)s' % {
"tokenId": req_params.get("token_id")
}
}
url = 'http://%(servername)s:%(port)d%(uri)s' % parms
hpc = HandlePycurl()
context = hpc.getData(hpc.initCurl(), url, head=[])
return HttpResponse(context)
示例2: v3_listprojects
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import getData [as 別名]
def v3_listprojects(request):
""" Lists projects.
Method:GET
URI:/v3/projects{?domain_id,name,enabled,page,per_page}
"""
req_params = {
"remotehost": request.GET.get("remotehost"),
"token_id": request.GET.get("token_id"),
"name": request.GET.get("role_name")
}
head = [
"X-Auth-Token: %s" % req_params.get("token_id"),
]
if req_params.get('name') == '': # and '' or '?name=%s' % req_params.get('name')
role_name = ''
else:
role_name = '?name=%s' % req_params.get('name')
parms = {
'servername': req_params.get("remotehost"),
'port': 5000,
'uri': '/v3/projects%s' % role_name
}
url = 'http://%(servername)s:%(port)d%(uri)s' % parms
hpc = HandlePycurl()
code, context = hpc.getData(hpc.initCurl(), url, head)
return HttpResponse(context)
示例3: v2_listTenantUserRoles
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import getData [as 別名]
def v2_listTenantUserRoles(request):
""" Lists roles for a specified user on a specified tenant. Excludes global roles.
Method:GET
URI:/v2.0/tenants/{tenantId}/users/{userId}/roles{?limit,marker}
"""
req_params = {
"token_id": request.GET.get("token_id"),
"remotehost": request.GET.get("remotehost"),
"tenantId": request.GET.get("tenantId"),
"userId": request.GET.get("userId"),
}
head = [
"X-Auth-Token: %s" % req_params.get("token_id"),
]
parms = {
'servername': req_params.get("remotehost"),
'port': 35357,
'uri': '/v2.0/tenants/%(tenantId)s/users/%(userId)s/roles' % {
"tenantId": req_params.get("tenantId"),
"userId": req_params.get("userId")
}
}
url = 'http://%(servername)s:%(port)d%(uri)s' % parms
hpc = HandlePycurl()
context = hpc.getData(hpc.initCurl(), url, head)
return HttpResponse(context)
示例4: v3_listProjectUserRole
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import getData [as 別名]
def v3_listProjectUserRole(request):
""" Lists roles for a user in a project.
Method:GET
URI:/v3/projects/{project_id}/users/{user_id}/roles
"""
req_params = {
"remotehost": request.GET.get("remotehost"),
"token_id": request.GET.get("token_id"),
"project_id": request.GET.get("project_id"),
"user_id": request.GET.get('user_id')
}
head = [
"X-Auth-Token: %s" % req_params.get("token_id"),
]
parms = {
'servername': req_params.get("remotehost"),
'port': 5000,
'uri': '/v3/projects/%(project_id)s/users/%(user_id)s/roles' % {
'project_id': req_params.get('project_id'),
'user_id': req_params.get('user_id')
}
}
url = 'http://%(servername)s:%(port)d%(uri)s' % parms
hpc = HandlePycurl()
code, context = hpc.getData(hpc.initCurl(), url, head)
return HttpResponse(context)
示例5: v3_listUserProject
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import getData [as 別名]
def v3_listUserProject(request):
""" List projects for a specified user.
Method:GET
URI:/v3/users/{user_id}/projects
"""
req_params = {
"remotehost": request.GET.get("remotehost"),
"token_id": request.GET.get("token_id"),
"user_id": request.GET.get("user_id")
}
head = [
"X-Auth-Token: %s" % req_params.get("token_id"),
]
parms = {
'servername': req_params.get("remotehost"),
'port': 5000,
'uri': '/v3/users/%(user_id)s/projects' % {
'user_id': req_params.get('user_id')
}
}
url = 'http://%(servername)s:%(port)d%(uri)s' % parms
hpc = HandlePycurl()
context = hpc.getData(hpc.initCurl(), url, head)
return HttpResponse(context)
示例6: v3_detailProject
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import getData [as 別名]
def v3_detailProject(request):
""" Shows details for a specified project.
Method:GET
URI:/v3/projects/{project_id}
"""
req_params = {
"remotehost": request.GET.get("remotehost"),
"token_id": request.GET.get("token_id"),
"project_id": request.GET.get("project_id")
}
head = [
"X-Auth-Token: %s" % req_params.get("token_id"),
]
parms = {
'servername': req_params.get("remotehost"),
'port': 5000,
'uri': '/v3/projects/%(project_id)s' % {
'project_id': req_params.get('project_id')
}
}
url = 'http://%(servername)s:%(port)d%(uri)s' % parms
hpc = HandlePycurl()
code, context = hpc.getData(hpc.initCurl(), url, head)
return HttpResponse(context)
示例7: v2_infoServiceById
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import getData [as 別名]
def v2_infoServiceById(request):
""" Gets a service.
Method:GET
URI:/v2.0/OS-KSADM/services/{serviceId}
"""
req_params = {
"token_id": request.GET.get("token_id"),
"remotehost": request.GET.get("remotehost"),
"service_id": request.GET.get("service_id"),
}
head = [
"X-Auth-Token: %s" % req_params.get("token_id"),
]
parms = {
'servername': req_params.get("remotehost"),
'port': 35357,
'uri': '/v2.0/OS-KSADM/services/%(serviceId)s' % {
"serviceId": req_params.get("service_id")
}
}
url = 'http://%(servername)s:%(port)d%(uri)s' % parms
hpc = HandlePycurl()
context = hpc.getData(hpc.initCurl(), url, head)
return HttpResponse(context)
示例8: v3_listRoles
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import getData [as 別名]
def v3_listRoles(request):
""" Lists roles.
Method:GET
URI:/v3/roles{?name,page,per_page}
"""
req_params = {
"token_id": request.GET.get("token_id"),
"remotehost": request.GET.get("remotehost"),
"name": request.GET.get('role_name')
}
head = [
"X-Auth-Token: %s" % req_params.get("token_id"),
]
if req_params.get('name') == '': # and '' or '?name=%s' % req_params.get('name')
role_name = ''
else:
role_name = '?name=%s' % req_params.get('name')
parms = {
'servername': req_params.get("remotehost"),
'port': 35357,
'uri': '/v3/roles%s' % role_name # ?name=_member_
}
url = 'http://%(servername)s:%(port)d%(uri)s' % parms
hpc = HandlePycurl()
context = hpc.getData(hpc.initCurl(), url, head)
return HttpResponse(context)
示例9: v2_detailImages
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import getData [as 別名]
def v2_detailImages(request):
""" Gets details for a specified image. (Since Image API v2.0.)
Method:GET
URI:/v2/images/{image_id}
"""
req_params = {
"token_id": request.GET.get("token_id"),
"remotehost": request.GET.get("remotehost"),
"image_id" : request.GET.get("image_id")
}
head = [
"X-Auth-Token: %s" % req_params.get("token_id"),
]
parms = {
'servername': req_params.get("remotehost"),
'port': 9292,
'uri': '/v2.0/images/%(image_id)s' % {
"image_id": req_params.get("image_id")
}
}
url = 'http://%(servername)s:%(port)d%(uri)s' % parms
hpc = HandlePycurl()
context = hpc.getData(hpc.initCurl(), url, head)
return HttpResponse(context)
示例10: v2_infoRoleByName
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import getData [as 別名]
def v2_infoRoleByName(request):
""" Gets a role by name.
Method:GET
URI:/v2.0/OS-KSADM/roles
"""
req_params = {
"token_id": request.GET.get("token_id"),
"remotehost": request.GET.get("remotehost"),
"tenantId": request.GET.get("tenantId") ,
"userId": request.GET.get("userId"),
"roleId": request.GET.get("roleId"),
}
token_id = 'ce894ef7c23d462fab19d8ace0b34e73'
head = [
"X-Auth-Token: %s" % token_id,
]
parms = {
'servername': '192.168.30.127',
'port': 35357,
'uri': '/v2.0/OS-KSADM/roles'
}
url = 'http://%(servername)s:%(port)d%(uri)s' % parms
hpc = HandlePycurl()
context = hpc.getData(hpc.initCurl(), url, head)
return HttpResponse(context)
示例11: v2_getImagesSchemasMember
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import getData [as 別名]
def v2_getImagesSchemasMember(request):
""" Gets a json-schema document that represents an image member entity. (Since Images v2.1.)
Method:GET
URI:/v2/schemas/member
"""
token_id = 'c72a23c2e61241748c2eaa063126fcb0'
head = [
"X-Auth-Token: %s" % token_id,
]
parms = {
'servername': '192.168.30.127',
'port': 9292,
'uri': '/v2/schemas/member'
}
url = 'http://%(servername)s:%(port)d%(uri)s' % parms
hpc = HandlePycurl()
context = hpc.getData(hpc.initCurl(), url, head)
return HttpResponse(context)
示例12: v2_listMeteringsMeteringLabelsRules
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import getData [as 別名]
def v2_listMeteringsMeteringLabelsRules(request):
""" Lists a summary of all l3 metering label rules belonging to the specified tenant.
Method:GET
URI:/v2.0/metering/metering-label-rules
"""
token_id = '2c769e9c9eea47c8bbd2c31712c51ba1'
head = [
"X-Auth-Token: %s"%token_id,
]
parms = {
'servername':'192.168.30.127',
'port':9696,
'uri':'/v2.0/metering/metering-label-rules'
}
url = 'http://%(servername)s:%(port)d%(uri)s'%parms
hpc = HandlePycurl()
context = hpc.getData(hpc.initCurl(),url,head)
return HttpResponse(context)
示例13: v2_listTenantUser
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import getData [as 別名]
def v2_listTenantUser(request):
""" Lists all users for a tenant.
Method: GET
URI:/v2.0/tenants/{tenantId}/users{?limit,marker}
"""
token_id = 'ce894ef7c23d462fab19d8ace0b34e73'
head = [
"X-Auth-Token: %s" % token_id,
]
parms = {
'servername': '192.168.30.127',
'port': 35357,
'uri': '/v2.0/tenants/%(tenantId)s/users' % {
"tenantId": "6929b9cbbd914699915ca8be4c283240"
}
}
url = 'http://%(servername)s:%(port)d%(uri)s' % parms
hpc = HandlePycurl()
context = hpc.getData(hpc.initCurl(), url, head)
return HttpResponse(context)
示例14: v2_showMeteringsMeteringLabels
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import getData [as 別名]
def v2_showMeteringsMeteringLabels(request):
""" Shows informations for a specified metering label.
Method:GET
URI:/v2.0/metering/metering-labels/{metering_label_id}
"""
token_id = '2c769e9c9eea47c8bbd2c31712c51ba1'
head = [
"X-Auth-Token: %s"%token_id,
]
parms = {
'servername':'192.168.30.127',
'port':9696,
'uri':'/v2.0/metering/metering-labels/%(metering_label_id)s'%{
"metering_label_id":"d185615d-821f-4d91-bd60-b9817f3d8540"
}
}
url = 'http://%(servername)s:%(port)d%(uri)s'%parms
hpc = HandlePycurl()
context = hpc.getData(hpc.initCurl(),url,head)
return HttpResponse(context)
示例15: v2_showMeteringsMeteringLabelsRules
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import getData [as 別名]
def v2_showMeteringsMeteringLabelsRules(request):
""" Shows detailed informations for a specified metering label rule.
Method:GET
URI:/v2.0/metering/metering-label-rules/{metering_label_rule_id}
"""
token_id = '2c769e9c9eea47c8bbd2c31712c51ba1'
head = [
"X-Auth-Token: %s"%token_id,
]
parms = {
'servername':'192.168.30.127',
'port':9696,
'uri':'/v2.0/metering/metering-label-rules/%(metering_label_rule_id)s'%{
"metering_label_rule_id":"ca0d86f2-fbe8-4829-9cc1-847925677878"
}
}
url = 'http://%(servername)s:%(port)d%(uri)s'%parms
hpc = HandlePycurl()
context = hpc.getData(hpc.initCurl(),url,head)
return HttpResponse(context)