Skip to main content

Official Glytos server SDK for Python.

Project description

glytos

The official Glytos server SDK for Python.

Call the Glytos API from your backend with an API key: build and run voice agents, start phone calls, mint browser web-call tokens, manage phone numbers, and verify webhooks.

Never ship an API key to the browser. For in-browser voice, use the @glytos/web package with a short-lived token you mint here.

Install

pip install glytos

Quickstart

from glytos import Glytos

glytos = Glytos(api_key="gly_...")

# List your agents
agents = glytos.workflows.list()

# Mint a web-call token for the browser
token = glytos.calls.web_token(workflow_uuid=agents[0]["uuid"])
print(token["token"], token["ws_url"])

Use it as a context manager to close the HTTP connection cleanly:

with Glytos(api_key="gly_...") as glytos:
    overview = glytos.request("GET", "/analytics/overview")

Resources

Namespace Methods
glytos.workflows list, retrieve, create, publish, delete, templates, session, session_events
glytos.calls create, list, retrieve, web_token, control
glytos.phone_numbers search, list, provision, assign, release
glytos.sessions list
glytos.webhooks list, create, delete, events, verify

Any endpoint without a dedicated helper is one call away with glytos.request(method, path, json=..., params=...).

Errors

Non-2xx responses raise a GlytosError with the API error code, HTTP status, and the request_id:

from glytos import GlytosError

try:
    glytos.workflows.retrieve("missing")
except GlytosError as err:
    print(err.status, err.code, err.message)

Webhooks

Verify a delivery came from Glytos before trusting it. Pass the raw request body, the X-Glytos-Signature header, and your endpoint secret:

from glytos import verify_webhook

# e.g. in a Flask/FastAPI handler
ok = verify_webhook(raw_body, request.headers["X-Glytos-Signature"], webhook_secret)
if not ok:
    abort(400)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glytos-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glytos-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file glytos-0.1.0.tar.gz.

File metadata

  • Download URL: glytos-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for glytos-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d4a262a3bf0bc8a6927c2cf89c4156e91dae7bb84fad9984aa8266ecea8ee2e5
MD5 74fc450e61061197f2c143b817946238
BLAKE2b-256 b5fe48871b9c213c7ad6909b0afa79a544dd720b64085617b14dc65cc2bfda8b

See more details on using hashes here.

File details

Details for the file glytos-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: glytos-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for glytos-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 91fc636339216f966200c46383fd0d2224123cdf398b7a31a608b9bff48bf88d
MD5 10c0501cf88b02b61b6d6ce390c56360
BLAKE2b-256 1d249003e28085bec54ea639217cab1badc562d81bab91e127f28b509f00101d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page