-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b48eb5
commit 0c461f3
Showing
3 changed files
with
48 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from livekit import api | ||
import asyncio | ||
|
||
|
||
async def main(): | ||
# will automatically use the LIVEKIT_API_KEY and LIVEKIT_API_SECRET env vars | ||
lkapi = api.LiveKitAPI("http://localhost:7880") | ||
room_info = await lkapi.room.create_room( | ||
api.CreateRoomRequest(name="my-room"), | ||
) | ||
print(room_info) | ||
room_list = await lkapi.room.list_rooms(api.ListRoomsRequest()) | ||
print(room_list) | ||
await lkapi.aclose() | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.get_event_loop().run_until_complete(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from livekit import api | ||
from aiohttp import web | ||
|
||
|
||
async def handle_webhook(request): | ||
token_verifier = api.TokenVerifier() | ||
webhook_receiver = api.WebhookReceiver(token_verifier) | ||
|
||
auth_token = request.headers.get("Authorization") | ||
if not auth_token: | ||
return web.Response(status=401) | ||
|
||
body = await request.read() | ||
event = webhook_receiver.receive(body.decode("utf-8"), auth_token) | ||
print("received event:", event) | ||
|
||
return web.Response(status=200) | ||
|
||
|
||
if __name__ == "__main__": | ||
app = web.Application() | ||
app.router.add_post("/", handle_webhook) | ||
web.run_app(app, port=3000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters