livekit-api 1.0.2__tar.gz → 1.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {livekit_api-1.0.2 → livekit_api-1.0.4}/PKG-INFO +5 -2
  2. livekit_api-1.0.4/README.md +6 -0
  3. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit/api/access_token.py +10 -7
  4. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit/api/room_service.py +33 -1
  5. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit/api/sip_service.py +5 -3
  6. livekit_api-1.0.4/livekit/api/version.py +1 -0
  7. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit_api.egg-info/PKG-INFO +5 -2
  8. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit_api.egg-info/requires.txt +1 -1
  9. {livekit_api-1.0.2 → livekit_api-1.0.4}/setup.py +1 -1
  10. livekit_api-1.0.2/README.md +0 -3
  11. livekit_api-1.0.2/livekit/api/version.py +0 -1
  12. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit/api/__init__.py +0 -0
  13. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit/api/_service.py +0 -0
  14. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit/api/agent_dispatch_service.py +0 -0
  15. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit/api/egress_service.py +0 -0
  16. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit/api/ingress_service.py +0 -0
  17. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit/api/livekit_api.py +0 -0
  18. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit/api/py.typed +0 -0
  19. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit/api/twirp_client.py +0 -0
  20. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit/api/webhook.py +0 -0
  21. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit_api.egg-info/SOURCES.txt +0 -0
  22. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit_api.egg-info/dependency_links.txt +0 -0
  23. {livekit_api-1.0.2 → livekit_api-1.0.4}/livekit_api.egg-info/top_level.txt +0 -0
  24. {livekit_api-1.0.2 → livekit_api-1.0.4}/pyproject.toml +0 -0
  25. {livekit_api-1.0.2 → livekit_api-1.0.4}/setup.cfg +0 -0
  26. {livekit_api-1.0.2 → livekit_api-1.0.4}/tests/test_access_token.py +0 -0
  27. {livekit_api-1.0.2 → livekit_api-1.0.4}/tests/test_webhook.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: livekit-api
3
- Version: 1.0.2
3
+ Version: 1.0.4
4
4
  Summary: Python Server API for LiveKit
5
5
  Home-page: https://github.com/livekit/python-sdks
6
6
  License: Apache-2.0
@@ -25,7 +25,7 @@ Requires-Dist: pyjwt>=2.0.0
25
25
  Requires-Dist: aiohttp>=3.9.0
26
26
  Requires-Dist: protobuf>=4
27
27
  Requires-Dist: types-protobuf>=4
28
- Requires-Dist: livekit-protocol~=1.0
28
+ Requires-Dist: livekit-protocol<2.0.0,>=1.0.4
29
29
  Dynamic: classifier
30
30
  Dynamic: description
31
31
  Dynamic: description-content-type
@@ -40,3 +40,6 @@ Dynamic: summary
40
40
  # LiveKit Server APIs
41
41
 
42
42
  Access LiveKit server APIs and generate access tokens.
43
+
44
+ See https://docs.livekit.io/reference/server/server-apis for more information.
45
+
@@ -0,0 +1,6 @@
1
+ # LiveKit Server APIs
2
+
3
+ Access LiveKit server APIs and generate access tokens.
4
+
5
+ See https://docs.livekit.io/reference/server/server-apis for more information.
6
+
@@ -39,6 +39,9 @@ class VideoGrants:
39
39
  room_join: Optional[bool] = None
40
40
  room: str = ""
41
41
 
42
+ # allows forwarding participant to room
43
+ destination_room: Optional[str] = None
44
+
42
45
  # permissions within a room
43
46
  can_publish: bool = True
44
47
  can_subscribe: bool = True
@@ -196,22 +199,22 @@ class TokenVerifier:
196
199
  api_key = api_key or os.getenv("LIVEKIT_API_KEY")
197
200
  api_secret = api_secret or os.getenv("LIVEKIT_API_SECRET")
198
201
 
199
- if not api_key or not api_secret:
200
- raise ValueError("api_key and api_secret must be set")
201
-
202
202
  self.api_key = api_key
203
203
  self.api_secret = api_secret
204
204
  self._leeway = leeway
205
205
 
206
- def verify(self, token: str) -> Claims:
206
+ def verify(self, token: str, *, verify_signature: bool = True) -> Claims:
207
+ if verify_signature and (not self.api_key or not self.api_secret):
208
+ raise ValueError("api_key and api_secret must be set")
209
+
207
210
  claims = jwt.decode(
208
211
  token,
209
- self.api_secret,
210
- issuer=self.api_key,
212
+ key=self.api_secret or "",
213
+ issuer=self.api_key or "",
211
214
  algorithms=["HS256"],
212
215
  leeway=self._leeway.total_seconds(),
216
+ options={"verify_signature": verify_signature},
213
217
  )
214
-
215
218
  video_dict = claims.get("video", dict())
216
219
  video_dict = {camel_to_snake(k): v for k, v in video_dict.items()}
217
220
  video_dict = {k: v for k, v in video_dict.items() if k in VideoGrants.__dataclass_fields__}
@@ -20,6 +20,8 @@ from livekit.protocol.room import (
20
20
  UpdateSubscriptionsResponse,
21
21
  ForwardParticipantRequest,
22
22
  ForwardParticipantResponse,
23
+ MoveParticipantRequest,
24
+ MoveParticipantResponse,
23
25
  )
24
26
  from livekit.protocol.models import Room, ParticipantInfo
25
27
  from ._service import Service
@@ -215,10 +217,40 @@ class RoomService(Service):
215
217
  SVC,
216
218
  "ForwardParticipant",
217
219
  forward,
218
- self._auth_header(VideoGrants(room_admin=True, room=forward.room)),
220
+ self._auth_header(
221
+ VideoGrants(
222
+ room_admin=True, room=forward.room, destination_room=forward.destination_room
223
+ )
224
+ ),
219
225
  ForwardParticipantResponse,
220
226
  )
221
227
 
228
+ async def move_participant(self, move: MoveParticipantRequest) -> None:
229
+ """Moves a participant from one room to another.
230
+
231
+ This feature is only available for LiveKit Cloud/Private Cloud.
232
+
233
+ Args:
234
+ move (MoveParticipantRequest): arg containing:
235
+ - room: str - Room name
236
+ - identity: str - Participant identity
237
+ - destination_room: str - Destination room name
238
+ """
239
+ # currently nothing is returned
240
+ await self._client.request(
241
+ SVC,
242
+ "MoveParticipant",
243
+ move,
244
+ self._auth_header(
245
+ VideoGrants(
246
+ room_admin=True,
247
+ room=move.room,
248
+ destination_room=move.destination_room,
249
+ )
250
+ ),
251
+ MoveParticipantResponse,
252
+ )
253
+
222
254
  async def mute_published_track(
223
255
  self,
224
256
  update: MuteRoomTrackRequest,
@@ -330,10 +330,12 @@ class SipService(Service):
330
330
  Only provided fields will be updated.
331
331
  """
332
332
  update = SIPDispatchRuleUpdate(
333
- name=name, metadata=metadata, rule=rule, attributes=attributes
333
+ name=name,
334
+ metadata=metadata,
335
+ rule=rule,
336
+ attributes=attributes,
337
+ trunk_ids=ListUpdate(set=trunk_ids) if trunk_ids else None,
334
338
  )
335
- if trunk_ids is not None:
336
- update.trunk_ids = ListUpdate(set=trunk_ids)
337
339
  return await self._client.request(
338
340
  SVC,
339
341
  "UpdateSIPDispatchRule",
@@ -0,0 +1 @@
1
+ __version__ = "1.0.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: livekit-api
3
- Version: 1.0.2
3
+ Version: 1.0.4
4
4
  Summary: Python Server API for LiveKit
5
5
  Home-page: https://github.com/livekit/python-sdks
6
6
  License: Apache-2.0
@@ -25,7 +25,7 @@ Requires-Dist: pyjwt>=2.0.0
25
25
  Requires-Dist: aiohttp>=3.9.0
26
26
  Requires-Dist: protobuf>=4
27
27
  Requires-Dist: types-protobuf>=4
28
- Requires-Dist: livekit-protocol~=1.0
28
+ Requires-Dist: livekit-protocol<2.0.0,>=1.0.4
29
29
  Dynamic: classifier
30
30
  Dynamic: description
31
31
  Dynamic: description-content-type
@@ -40,3 +40,6 @@ Dynamic: summary
40
40
  # LiveKit Server APIs
41
41
 
42
42
  Access LiveKit server APIs and generate access tokens.
43
+
44
+ See https://docs.livekit.io/reference/server/server-apis for more information.
45
+
@@ -2,4 +2,4 @@ pyjwt>=2.0.0
2
2
  aiohttp>=3.9.0
3
3
  protobuf>=4
4
4
  types-protobuf>=4
5
- livekit-protocol~=1.0
5
+ livekit-protocol<2.0.0,>=1.0.4
@@ -53,7 +53,7 @@ setuptools.setup(
53
53
  "aiohttp>=3.9.0",
54
54
  "protobuf>=4",
55
55
  "types-protobuf>=4",
56
- "livekit-protocol~=1.0",
56
+ "livekit-protocol>=1.0.4,<2.0.0",
57
57
  ],
58
58
  package_data={
59
59
  "livekit.api": ["py.typed", "*.pyi", "**/*.pyi"],
@@ -1,3 +0,0 @@
1
- # LiveKit Server APIs
2
-
3
- Access LiveKit server APIs and generate access tokens.
@@ -1 +0,0 @@
1
- __version__ = "1.0.2"
File without changes
File without changes