本文整理匯總了Python中openstack.utils.HandlePycurl.patchData方法的典型用法代碼示例。如果您正苦於以下問題:Python HandlePycurl.patchData方法的具體用法?Python HandlePycurl.patchData怎麽用?Python HandlePycurl.patchData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類openstack.utils.HandlePycurl
的用法示例。
在下文中一共展示了HandlePycurl.patchData方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: v2_updateImages
# 需要導入模塊: from openstack.utils import HandlePycurl [as 別名]
# 或者: from openstack.utils.HandlePycurl import patchData [as 別名]
def v2_updateImages(request):
""" Updates a specified image. (Since Image API v2.0.)
Method:PATCH
URI:/v2/images/{image_id}
"""
req_params = {
"token_id": request.POST.get("token_id"),
"remotehost": request.POST.get("remotehost"),
"image_id": request.POST.get("image_id")
}
data = [
{
"op": "replace",
"path": "/name",
"value": "Fedora 17"
},
{
"op": "replace",
"path": "/tags",
"value": [
"fedora",
"beefy"
]
}
]
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.patchData(hpc.initCurl(), url, json.dumps(data), head)
return HttpResponse(context)