If you search for the official python SDK for Rackspace Cloud - you're likely to find pyrax.
But I guess by summer '15 they were full on the Openstack-SDK ride!
Openstack-SDK seems like a decent attempt to organize things. Docs are decent. But my first attempt to do something 401'd
In [68]: conn.authorize() --------------------------------------------------------------------------- HttpException Traceback (most recent call last)in () ----> 1 conn.authorize() /private/tmp/test-os-sdk/lib/python2.7/site-packages/openstack/connection.pyc in authorize(self) 264 raise exceptions.HttpException("Unknown exception", 265 six.text_type(ex), --> 266 status_code=500) 267 268 return headers.get('X-Auth-Token') if headers else None HttpException: HttpException: Unknown exception, Unauthorized (HTTP 401)
Turns out, the openstack.connection.Connection class doesn't work quite like novaclient, a few params are different. Instead of using your API Key - you need to use your password:
from openstack import connection conn = connection.Connection( auth_url='https://identity.api.rackspacecloud.com/v2.0/', username='username', password='password') # <- NOT API KEY!!!
After that the only tricky part was setting the region:
conn.profile.set_region(conn.profile.ALL, 'IAD')
1 comment:
The OpenStack SDK for Rackspace HostingSpell enables developers to interact with Rackspace cloud services using OpenStack APIs for tasks like managing instances, networks, and storage.
Post a Comment