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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a36f26f7dd7ea9a0e588c6e9413daddd36d625217405de15619359f0ee8d0803 |
|
MD5 | 921657e05d8ada3353c8c8cb13602790 |
|
BLAKE2b-256 | f9dae15e98782834097ac82358a21345d71b9ba9e170a3aaa79a3cea1fed7a96 |
Close
Hashes for livekit_server_sdk_python-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f4c930dccec204e32e2e116a1c36c37981d991333e3f0a440384a332e6ae388 |
|
MD5 | 824e06f1588f031e43c06b3e6cfeb9c8 |
|
BLAKE2b-256 | 767f6bb8a3bd299299a0d6ec6a68e6cfbe7dd1131403e72624f7b128e9f9c0b5 |