variable_values. For more information, see Use the SDK client. For worked examples, see the SDK recipes.
Install the Validio SDK
The Validio SDK is published as a Python package on PyPI asvalidio-sdk. You can use a Python package installer, such as pip, to install the SDK in your desired environment:
Bash
validio-cli installs both.
Authentication
You need an API key, made up of an access key and an access secret, to interact with the Validio API. The client finds your credentials automatically, by looking for environment variables and then for aconfig.json. For the full lookup order, see How the CLI and SDK find credentials. You can create the config.json with the Validio CLI by running validio config init.
To specify the credentials yourself, pass a ValidioConfig when you create the client. You can also pass headers, a dictionary of additional headers to send with every request:
Python
Use the SDK client
For more examples of how to use the client, see the SDK recipes.Send a query
This example creates a client with explicit credentials, sends asourcesList query with a variable that filters on a namespace, and prints the name of each source:
Python
sourcesList.
Synchronous or asynchronous
The client is written to be used asynchronously, so it needs an asynchronous runtime. This allows safe concurrent use, and lets you run multiple operations at the same time when needed. To use the client in a non-asynchronous context, wrap the request inasyncio.run:
Python
Use the same client in different threads
To use the client across multiple threads at the same time, use a session. The session is opened before the first request and isn’t closed until all requests are done. Open one with anasync with block. The session it returns is a validio_sdk.client.Session, which has the same execute method as the client:
Python