Install
The SDK is at version 0.1, a beta: it may change between 0.x releases. The source is public at github.com/Larynth-Labs/larynth-python. Report problems there.
Configure
Create an API key in the dashboard and keep it in an environment variable.larynth.generated.api.<tag>, and each is named after its operation: list_assistants, create_call, get_call_analysis. Request and response models live in larynth.generated.models.
Each module has four functions:
Use the client as a context manager so connections are closed.
Example: list assistants
Example: place a call
create_call needs an idempotency key so a retry cannot place the call twice. See idempotency. Use only numbers you have the right to call. Outbound calls go through the same compliance checks as a campaign.
Example: read a call summary
Example: create a webhook endpoint
Handle errors
sync returns a Problem model when the API answers with a documented error status. Check for it before you use the result. sync_detailed gives you the status code as well.
larynth.generated.errors.UnexpectedStatus.
Verify webhooks
verify raises WebhookVerificationError if the signature or timestamp is wrong. sign builds a signature, which is useful in tests. See verify signatures.