validio_sdk.client package

Module contents

class validio_sdk.client.Client(config: ValidioConfig | None = None, user_agent: str = 'validio-sdk@0.0.1.dev1', headers: dict[str, str] = {})

Bases: object

A GraphQL client with sensible defaults for Validio.

NOTE! The client used in the examples below is in beta and breaking changes may happen.

It will be created by reading the Validio configuration just like the CLI tool and ensure the correct headers are passed.

If no ValidioConfig is passed when constructing the client, it will fallback to first look for required environment variables:

  • VALIDIO_ENDPOINT

  • VALIDIO_ACCESS_KEY

  • VALIDIO_SECRET_ACCESS_KEY

If not all of them are found, it will look for a configuration file. It will first look in the path set in VALIDIO_CONFIG_PATH and if that one is empty it will look in the default OS dependant system directory.

async execute(query: str, **kwargs) Any

Execute a GraphQL request.

Parameters:
  • query – The query to be executed

  • kwargs – Arguments matching the GraphQL client e.g. variable_values and operation_name.

Returns:

The API response

class validio_sdk.client.Session(session: AsyncClientSession)

Bases: object

A session to perform multiple requests.

NOTE! The client used in the examples below is in beta and breaking changes may happen.

A session will support running multiple requests with the same client. It will ensure the connection is open and not closed until the session goes out of scope.

async execute(query: str, **kwargs) Any

Execute a query in the session.

Parameters:
  • query – The query to be executed

  • kwargs – Arguments matching the GraphQL client e.g. variable_values and operation_name.

Returns:

The API response