python code to upload image to openstack

asked 2014-05-27 07:26:50 -0500

Ukesh gravatar image

updated 2014-05-28 00:05:24 -0500

Can any one tell how to upload image using only RESTapi in python. I tried with httplib2, but not working. I don't want to use python-glanceclient, since have to install it separately in my client machine.

hostUrl = self.image_url + '/v1/images/' + json_list['id']

h = httplib2.Http()

resp, content = h.request(hostUrl, "PUT", body=open(file,'rb'), headers={ 'Content-type': 'application/octet-stream', 'X-Auth-Token': self.token })

edit retag flag offensive close merge delete


similar to (

igorm gravatar imageigorm ( 2014-09-20 18:10:31 -0500 )edit