OpenStack provides four different options for interacting with its APIs from Python, each targetting a slightly different user.
- OpenStack SDK
- Per-project client libraries
- Direct REST calls via keystoneauth
You should also be familiar with:
- RESTful web services
- JSON and data serialization formats
The OpenStack Python Software Development Kit (SDK) is used to write Python automation scripts that create and manage resources in your OpenStack cloud. The SDK implements Python bindings to the OpenStack API, which enables you to perform automation tasks in Python by making calls on Python objects, rather than making REST calls directly.
New users should default to coding against the OpenStack SDK.
shade is a an abstraction library focused on hiding implementation differences between OpenStack clouds. While the OpenStack SDK presents a clean object interface to the underlying REST APIs, shade hides them if doing so is advantageous. If you plan on running the same python program against many OpenStack clouds, you may want to use shade - but if you need to access any features of a cloud that do not have an cloud-neutral abstraction mapping, you will be unable to do so with shade.
Per-project client libraries
Each OpenStack project produces a client library that wraps its own REST API. Unless there is no other choice for some reason, the per-project libraries should be avoided.
Direct REST calls via keystoneauth
All of OpenStack’s APIs are actually REST APIs. The keystoneauth library provides an object that looks very much like a Session object from the Python requests library that handles all of the authentication for you. If you are more comfortable just dealing with REST, or if there is a feature implemented in your cloud that has not seen support in any of the libraries yet, this option is for you.