How to create Swift Connection using python API on HP Cloud
Hi, I am working with HP Openstack. I am trying to get create a Swift Connection and then add a container. How can I do that through Python API.
I wrote the following code which ends up saying :-
swiftclient.exceptions.ClientException:
Auth GET failed:
https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/ 405 Method Not Allowed
Code:-
__author__ = 'Dhana'
import swiftclient.client as swift_client
import os
def get_swift_creds():
return {'user': os.environ['OS_USERNAME'], 'key': os.environ['OS_PASSWORD'],
'authurl': os.environ['OS_AUTH_URL'], 'tenant_name': os.environ['OS_TENANT_NAME']}
if __name__ == '__main__':
creds = get_swift_creds()
conn = swift_client.Connection(**creds)
conn.post_container('MyContainer', None)
print 'Container success!'
conn.close()