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
import livekit
grant = livekit.VideoGrant(room_join=True, room="My Cool Room")
access_token = livekit.AccessToken("<api key>", "<api secret>", grant=grant, identity="bob", name="Bob")
token = access_token.to_jwt()
Using RoomServiceClient
import livekit
client = livekit.RoomServiceClient("<host>", "<api key>", "<api secret>")
client.mute_published_track(
room="<room name>",
identity="Bob",
track_sid="<track sid>",
muted=True,
)
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-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b040f9d7531d06e9ae5efebd524e49da41b7aa719ad27879f6ed66df7d0f1f0e |
|
MD5 | 173f825085f8394fd9e7477dcb52cffa |
|
BLAKE2b-256 | 853f7bbb1cd13a9f782acbab85cc567044c43ff05affdc5c1d8f2e725f190ed2 |
Close
Hashes for livekit_server_sdk_python-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 313661336a9aa9adcc8508983f85373ad0b48c77cb36f634332484acd186f859 |
|
MD5 | dfa2745a12c3a1b3b635c29fddd85bb0 |
|
BLAKE2b-256 | c3ce02764c613e924537632c8a4b5e2258d6495d9b8cecb7155aa3dfb29f3144 |