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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9e9b4eb0651a9f01a19cae219acb2dbb3082cb12f9a7990b74233bdb65e5f5f |
|
MD5 | fa20ae72572d3d4737db7907a591f5f1 |
|
BLAKE2b-256 | 744a39899f40fc2abaee614d9a9ed49f2f05d69b7c6b5738c480c7ab133ad03f |
Close
Hashes for livekit_server_sdk_python-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87cf2a64ec96f4dc90c7c5893e78d1389d2e874a1f66cccb7644465ebbf61c8a |
|
MD5 | 4e4d334328a999aad15a65598c39a0a0 |
|
BLAKE2b-256 | 01fe41929c01585d19c5f511d4d08b0add25ecb78c88d9553b0141d15113a523 |