API
diracx-api
The diracx-api
provides a Python API for interacting with services, leveraging the diracx-client
.
API Methods
API methods are located in diracx-api/src/diracx/api/
. To create an API method:
- Import
AsyncDiracClient
. - Decorate the method with
@with_client
to handle client configuration. - Pass the
client
as a keyword argument.
Example
from diracx.client.aio import AsyncDiracClient
from .utils import with_client
@with_client
async def create_sandbox(paths: list[Path], *, client: AsyncDiracClient) -> str: ...
In this example, paths
are the parameters of the API. The @with_client
decorator allows the method to be called without manually managing the client: