Skip to content

client ¤

EndpointClient ¤

EndpointClient(
    http_client: Client,
    signing_key: Ed25519PrivateKey | None = None,
)

Test client for a Dispatch programmable endpoint.

Note that this is different from dispatch.Client, which is a client for the Dispatch API. The EndpointClient is a client similar to the one that Dispatch itself would use to interact with an endpoint that provides functions, for example a FastAPI app.

Parameters:

Name Type Description Default
http_client Client

Client to use to make HTTP requests.

required
signing_key Ed25519PrivateKey | None

Optional Ed25519 private key to use to sign requests.

None

run ¤

run(request: RunRequest) -> RunResponse

Send a run request to an endpoint and return its response.

Parameters:

Name Type Description Default
request RunRequest

A FunctionService Run request.

required

Returns:

Name Type Description
RunResponse RunResponse

the response from the endpoint.

from_url classmethod ¤

from_url(
    url: str, signing_key: Ed25519PrivateKey | None = None
)

Returns an EndpointClient for a Dispatch endpoint URL.

from_app classmethod ¤

from_app(
    app: FastAPI,
    signing_key: Ed25519PrivateKey | None = None,
)

Returns an EndpointClient for a Dispatch endpoint bound to a FastAPI app instance.