Livekit Server SDK for Python
Project description
LiveKit Server SDK
API Reference: https://docs.livekit.io/guides/server-api
Examples
Generate Access Token for a Client
from livekit import AccessToken, VideoGrant
grant = VideoGrant(room_join=True, room="My Cool Room")
access_token = AccessToken("<api key>", "<api secret>", grant=grant, identity="Bob")
token = access_token.to_jwt()
Using RoomServiceClient
from livekit import RoomServiceClient
client = RoomServiceClient("<host>", "<api key>", "<api secret>")
client.mute_published_track(room="<room name>", track="<track sid>")
Local Development
Dependencies
- golang >= 1.17
- protoc
- Ubuntu:
sudo apt install protobuf-compiler
- Ubuntu:
- protoc-gen-twirpy
go install github.com/verloop/twirpy/protoc-gen-twirpy@latest
- make sure
~/go/bin
is in your$PATH
- pre-commit
Environment Setup
Please make sure you have installed pre-commit, and install the hooks:
$ pre-commit install
Set up the python virtual environment:
$ python3 -m venv env
$ source env/bin/activate
$ pip install --editable '.[dev]'
Run tests
The RoomServiceClient
tests require a running LiveKit server.
See the LiveKit Getting Started page.
The tests use the following environment variables to locate the LiveKit server.
export LIVEKIT_HOST='http://localhost:7880'
export LIVEKIT_API_KEY='<api key>'
export LIVEKIT_API_SECRET='<api secret>'
Run the tests:
$ pytest
Updating protocol
The build.sh
script pulls the latest tag and builds
$ ./bin/build.sh
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for livekit_server_sdk_python-0.3.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b668c876c93d70436ea3f5aa67c69e73427c4b41a3cd5e26ce4088dee2d8ebbd |
|
MD5 | d65a54f081a7cbae0627b8527c2833ea |
|
BLAKE2b-256 | 0719dbbfb0947324bb68223e06021a54be9ccda6483208bc673e0af4082740b3 |
Close
Hashes for livekit_server_sdk_python-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95b8e234a47103b6cfa1c392fe0e775e50f0ab715a70ef25f86dc7e9c5954ad7 |
|
MD5 | 68caddc20ff817e9a1e74de0a0a01dec |
|
BLAKE2b-256 | e0170125101360d740de1ac0d6a2495dcfa2fc2d4b128e9b28809a4ec6f9ba94 |