Skip to main content

python-client

Connect to a Scrypted server from Python and use the same SDK objects (systemManager, deviceManager, mediaManager) that Python plugins see.

The modules in this directory are symlinks into ../../server/python and ../../sdk/types so the client and the plugin runtime share one implementation.

Usage

Installed from PyPI, everything lives under the scrypted_sdk package:

pip install scrypted-sdk
from scrypted_sdk import connect_scrypted_client

From a checkout of this repository, the modules are importable directly:

pip install -r requirements.txt
import asyncio

from scrypted_client import connect_scrypted_client


async def main(loop):
    transport, sdk = await connect_scrypted_client(
        loop, "https://localhost:10443", "username", "password"
    )
    for id in sdk.systemManager.getSystemState():
        print(sdk.systemManager.getDeviceById(id).name)
    await transport.close()


loop = asyncio.new_event_loop()
loop.run_until_complete(main(loop))

test.py is a runnable version of the above; point it at a server with the SCRYPTED_BASE_URL, SCRYPTED_USERNAME, and SCRYPTED_PASSWORD environment variables.

examples/light.py is the Python equivalent of packages/client/examples/light.ts — it turns a named light on and back off:

SCRYPTED_USERNAME=admin SCRYPTED_PASSWORD=swordfish python examples/light.py "Office Dimmer"

It works both with pip install scrypted-sdk and directly from a repo checkout with only requirements.txt installed.

By default the login request and the engine.io connection skip TLS certificate verification, since Scrypted servers use self-signed certificates out of the box. To control TLS (or connection pooling), pass your own login_session and a pre-built EioRpcTransport(loop, http_session=...).

Session ownership: a login_session you pass is only borrowed for the login request and is never closed. An http_session passed to EioRpcTransport becomes owned by the transport — transport.close() closes it along with the engine.io connection and background tasks — so don't share that session with anything else.

Packaging

The scrypted-sdk PyPI package is built from this directory. Because the modules here are flat top-level modules (that is how the plugin runtime loads them), publishing them as-is would install modules named rpc, plugin_remote, etc. into consumers' environments. Instead, a build hook (hatch_build.py) generates a scrypted_sdk package at build time: it copies each module (reading through the symlinks) and mechanically rewrites the flat imports to package-qualified ones (import rpcfrom scrypted_sdk import rpc). Nothing is committed and no runtime code is modified beyond that rewrite.

To build locally:

pip install build && python -m build   # or: uv build

To release: bump version in pyproject.toml and push a python-sdk-v* tag. The Python SDK workflow builds, smoke-tests, and publishes to PyPI via trusted publishing — the PyPI project just needs koush/scrypted + python-sdk.yml registered as a trusted publisher (no API tokens).

Download files

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

Source Distribution

scrypted_sdk-0.1.0.tar.gz (48.4 kB view details)

Uploaded Source

Built Distribution

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

scrypted_sdk-0.1.0-py3-none-any.whl (49.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scrypted_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 48.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for scrypted_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1cd5b9a4b3d9f80a6394617fa3db3b685b30e4404372a574af9b06a5783cb637
MD5 30f69368cdfa2602d091a4b3d628e440
BLAKE2b-256 801b345dfebb75e9a60b9b504baf60e9e34f98a0305db4c85880f6a6ac1aacb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrypted_sdk-0.1.0.tar.gz:

Publisher: python-sdk.yml on koush/scrypted

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: scrypted_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 49.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for scrypted_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90ff51e78ccd89ed9c122e74f5444fe46b4286585a872da0de4032bcf71bf147
MD5 25ce51d451d50d4dc97d89d9dc2a398f
BLAKE2b-256 f6f1c625db88e60b4da91f7eb547ced5d38cd0b0b4c5e9e7c745f778d69cc846

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrypted_sdk-0.1.0-py3-none-any.whl:

Publisher: python-sdk.yml on koush/scrypted

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.1

2 files

This release

0.1.0 This release

2 files

0.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page