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", name="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
Make sure you clone with submodules:
$ git clone --recurse-submodules https://github.com/tradablebits/livekit-server-sdk-python.git
Or if you have already cloned:
$ git submodule update --init
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
Set up the python virtual environment:
$ python3 -m venv env
$ source env/bin/activate
$ pip install --editable '.[dev]'
$ pre-commit install
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.4.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe325b70af20277f4dc4df694d961c37a83b4d237c140a5a39920a015e705ccc |
|
MD5 | 550e5c2c64c85988afe6359816cbc1f1 |
|
BLAKE2b-256 | e404e01228276ba9021ccba1e8d0fa173360cf55df4e642c2c3ec3e496bb5e94 |
Close
Hashes for livekit_server_sdk_python-0.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e8f03403273df818a7252b15d1fd4386dce63ac5ebb275f337c275477a833c9 |
|
MD5 | 78c145210fadec1e917998603652d4af |
|
BLAKE2b-256 | 9f61c5cc1e87c1bb500bcbdb436ea23df63c69c2c97ab03ea2a9af95635ffd5c |