Waldur SDK
Waldur SDK is a python wrapper
for typical REST operations.
You can use it, if you want to send requests to Waldur REST API directly from Python.
SDK is represented by Python module called waldur_client.py
from ansible-waldur-module
repository.
Installation
Due to frequent SDK updates, installation from the public GitHub repository is highly recommended:
1 |
|
In order to perform operations, a user needs to create an instance of WaldurClient
class:
1 2 3 |
|
This instance provides interface for further interaction with Waldur and will be used across examples in related documentation.
Error handling
If the client fails to perform an operation, it raises WaldurClientException
. This can be handled using try...except
block.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Disabling TLS validation (not recommended!)
If you are running your commands against Waldur deployment with broken TLS certificates (e.g. in development), the trick below can be used to disable validation of certificates by SDK.
1 2 3 4 5 6 7 8 |
|
Air gapped installation
If your machine from where you run SDK is not connected to the public Internet, you can use the following method to transfer required libraries.
On the machine with access to the Internet:
1 2 3 |
|
Now transfer content of the dependencies folder and requirements.txt to a machine without public Internet and run.
1 |
|