livekit-api 0.2.1__tar.gz → 0.4.0__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.
- {livekit-api-0.2.1 → livekit-api-0.4.0}/PKG-INFO +6 -6
- {livekit-api-0.2.1 → livekit-api-0.4.0}/livekit/api/__init__.py +6 -5
- {livekit-api-0.2.1 → livekit-api-0.4.0}/livekit/api/_service.py +2 -2
- {livekit-api-0.2.1 → livekit-api-0.4.0}/livekit/api/access_token.py +18 -7
- livekit-api-0.4.0/livekit/api/livekit_api.py +46 -0
- livekit-api-0.2.1/livekit/api/_twirp_client.py → livekit-api-0.4.0/livekit/api/twirp_client.py +11 -4
- livekit-api-0.4.0/livekit/api/version.py +1 -0
- {livekit-api-0.2.1 → livekit-api-0.4.0}/livekit_api.egg-info/PKG-INFO +6 -6
- {livekit-api-0.2.1 → livekit-api-0.4.0}/livekit_api.egg-info/SOURCES.txt +1 -1
- livekit-api-0.4.0/livekit_api.egg-info/requires.txt +5 -0
- {livekit-api-0.2.1 → livekit-api-0.4.0}/setup.py +5 -5
- {livekit-api-0.2.1 → livekit-api-0.4.0}/tests/test_access_token.py +1 -1
- livekit-api-0.2.1/livekit/api/livekit_api.py +0 -35
- livekit-api-0.2.1/livekit/api/version.py +0 -1
- livekit-api-0.2.1/livekit_api.egg-info/requires.txt +0 -5
- {livekit-api-0.2.1 → livekit-api-0.4.0}/README.md +0 -0
- {livekit-api-0.2.1 → livekit-api-0.4.0}/livekit/api/egress_service.py +0 -0
- {livekit-api-0.2.1 → livekit-api-0.4.0}/livekit/api/ingress_service.py +0 -0
- {livekit-api-0.2.1 → livekit-api-0.4.0}/livekit/api/room_service.py +0 -0
- {livekit-api-0.2.1 → livekit-api-0.4.0}/livekit/api/webhook.py +0 -0
- {livekit-api-0.2.1 → livekit-api-0.4.0}/livekit_api.egg-info/dependency_links.txt +0 -0
- {livekit-api-0.2.1 → livekit-api-0.4.0}/livekit_api.egg-info/top_level.txt +0 -0
- {livekit-api-0.2.1 → livekit-api-0.4.0}/pyproject.toml +0 -0
- {livekit-api-0.2.1 → livekit-api-0.4.0}/setup.cfg +0 -0
- {livekit-api-0.2.1 → livekit-api-0.4.0}/tests/test_webhook.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: livekit-api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Python Server API for LiveKit
|
|
5
5
|
Home-page: https://github.com/livekit/python-sdks
|
|
6
6
|
License: Apache-2.0
|
|
@@ -19,13 +19,13 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.9
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
21
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
-
Requires-Python: >=3.
|
|
22
|
+
Requires-Python: >=3.8.0
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
Requires-Dist: pyjwt>=2.0.0
|
|
25
|
-
Requires-Dist: aiohttp>=3.
|
|
26
|
-
Requires-Dist: protobuf
|
|
27
|
-
Requires-Dist: types-protobuf
|
|
28
|
-
Requires-Dist: livekit-protocol
|
|
25
|
+
Requires-Dist: aiohttp>=3.9.0
|
|
26
|
+
Requires-Dist: protobuf==4.25.1
|
|
27
|
+
Requires-Dist: types-protobuf<5,>=4
|
|
28
|
+
Requires-Dist: livekit-protocol~=0.3.0
|
|
29
29
|
|
|
30
30
|
# LiveKit Server APIs
|
|
31
31
|
|
|
@@ -17,12 +17,13 @@
|
|
|
17
17
|
|
|
18
18
|
# flake8: noqa
|
|
19
19
|
# re-export packages from protocol
|
|
20
|
-
from livekit.protocol.egress import *
|
|
21
|
-
from livekit.protocol.ingress import *
|
|
22
|
-
from livekit.protocol.models import *
|
|
23
|
-
from livekit.protocol.room import *
|
|
24
|
-
from livekit.protocol.webhook import *
|
|
20
|
+
from livekit.protocol.egress import * # type: ignore
|
|
21
|
+
from livekit.protocol.ingress import * # type: ignore
|
|
22
|
+
from livekit.protocol.models import * # type: ignore
|
|
23
|
+
from livekit.protocol.room import * # type: ignore
|
|
24
|
+
from livekit.protocol.webhook import * # type: ignore
|
|
25
25
|
|
|
26
|
+
from .twirp_client import TwirpError, TwirpErrorCode
|
|
26
27
|
from .livekit_api import LiveKitAPI
|
|
27
28
|
from .access_token import VideoGrants, AccessToken, TokenVerifier
|
|
28
29
|
from .webhook import WebhookReceiver
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from typing import Dict
|
|
2
2
|
import aiohttp
|
|
3
3
|
from abc import ABC
|
|
4
|
-
from .
|
|
4
|
+
from .twirp_client import TwirpClient
|
|
5
5
|
from .access_token import AccessToken, VideoGrants
|
|
6
6
|
|
|
7
7
|
AUTHORIZATION = "authorization"
|
|
@@ -9,7 +9,7 @@ AUTHORIZATION = "authorization"
|
|
|
9
9
|
|
|
10
10
|
class Service(ABC):
|
|
11
11
|
def __init__(
|
|
12
|
-
self, host: str, api_key: str, api_secret: str
|
|
12
|
+
self, session: aiohttp.ClientSession, host: str, api_key: str, api_secret: str
|
|
13
13
|
):
|
|
14
14
|
self._client = TwirpClient(session, host, "livekit")
|
|
15
15
|
self.api_key = api_key
|
|
@@ -18,6 +18,7 @@ import re
|
|
|
18
18
|
import datetime
|
|
19
19
|
import os
|
|
20
20
|
import jwt
|
|
21
|
+
from typing import Optional, List
|
|
21
22
|
|
|
22
23
|
DEFAULT_TTL = datetime.timedelta(hours=6)
|
|
23
24
|
DEFAULT_LEEWAY = datetime.timedelta(minutes=1)
|
|
@@ -43,7 +44,7 @@ class VideoGrants:
|
|
|
43
44
|
# TrackSource types that a participant may publish.
|
|
44
45
|
# When set, it supercedes CanPublish. Only sources explicitly set here can be
|
|
45
46
|
# published
|
|
46
|
-
can_publish_sources:
|
|
47
|
+
can_publish_sources: List[str] = dataclasses.field(default_factory=list)
|
|
47
48
|
|
|
48
49
|
# by default, a participant is not allowed to update its own metadata
|
|
49
50
|
can_update_own_metadata: bool = False
|
|
@@ -74,14 +75,18 @@ class Claims:
|
|
|
74
75
|
class AccessToken:
|
|
75
76
|
def __init__(
|
|
76
77
|
self,
|
|
77
|
-
api_key: str =
|
|
78
|
-
api_secret: str =
|
|
78
|
+
api_key: Optional[str] = None,
|
|
79
|
+
api_secret: Optional[str] = None,
|
|
79
80
|
) -> None:
|
|
81
|
+
api_key = api_key or os.getenv("LIVEKIT_API_KEY")
|
|
82
|
+
api_secret = api_secret or os.getenv("LIVEKIT_API_SECRET")
|
|
83
|
+
|
|
84
|
+
if not api_key or not api_secret:
|
|
85
|
+
raise ValueError("api_key and api_secret must be set")
|
|
86
|
+
|
|
80
87
|
self.api_key = api_key # iss
|
|
81
88
|
self.api_secret = api_secret
|
|
82
89
|
self.claims = Claims()
|
|
83
|
-
if not api_key or not api_secret:
|
|
84
|
-
raise ValueError("api_key and api_secret must be set")
|
|
85
90
|
|
|
86
91
|
# default jwt claims
|
|
87
92
|
self.identity = "" # sub
|
|
@@ -137,11 +142,17 @@ class AccessToken:
|
|
|
137
142
|
class TokenVerifier:
|
|
138
143
|
def __init__(
|
|
139
144
|
self,
|
|
140
|
-
api_key: str =
|
|
141
|
-
api_secret: str =
|
|
145
|
+
api_key: Optional[str] = None,
|
|
146
|
+
api_secret: Optional[str] = None,
|
|
142
147
|
*,
|
|
143
148
|
leeway: datetime.timedelta = DEFAULT_LEEWAY,
|
|
144
149
|
) -> None:
|
|
150
|
+
api_key = api_key or os.getenv("LIVEKIT_API_KEY")
|
|
151
|
+
api_secret = api_secret or os.getenv("LIVEKIT_API_SECRET")
|
|
152
|
+
|
|
153
|
+
if not api_key or not api_secret:
|
|
154
|
+
raise ValueError("api_key and api_secret must be set")
|
|
155
|
+
|
|
145
156
|
self.api_key = api_key
|
|
146
157
|
self.api_secret = api_secret
|
|
147
158
|
self._leeway = leeway
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import aiohttp
|
|
2
|
+
import os
|
|
3
|
+
from .room_service import RoomService
|
|
4
|
+
from .egress_service import EgressService
|
|
5
|
+
from .ingress_service import IngressService
|
|
6
|
+
from typing import Optional
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class LiveKitAPI:
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
url: Optional[str] = None,
|
|
13
|
+
api_key: Optional[str] = None,
|
|
14
|
+
api_secret: Optional[str] = None,
|
|
15
|
+
*,
|
|
16
|
+
timeout: aiohttp.ClientTimeout = aiohttp.ClientTimeout(total=60), # 60 seconds
|
|
17
|
+
):
|
|
18
|
+
url = url or os.getenv("LIVEKIT_URL")
|
|
19
|
+
api_key = api_key or os.getenv("LIVEKIT_API_KEY")
|
|
20
|
+
api_secret = api_secret or os.getenv("LIVEKIT_API_SECRET")
|
|
21
|
+
|
|
22
|
+
if not url:
|
|
23
|
+
raise ValueError("url must be set")
|
|
24
|
+
|
|
25
|
+
if not api_key or not api_secret:
|
|
26
|
+
raise ValueError("api_key and api_secret must be set")
|
|
27
|
+
|
|
28
|
+
self._session = aiohttp.ClientSession(timeout=timeout)
|
|
29
|
+
self._room = RoomService(self._session, url, api_key, api_secret)
|
|
30
|
+
self._ingress = IngressService(self._session, url, api_key, api_secret)
|
|
31
|
+
self._egress = EgressService(self._session, url, api_key, api_secret)
|
|
32
|
+
|
|
33
|
+
@property
|
|
34
|
+
def room(self):
|
|
35
|
+
return self._room
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def ingress(self):
|
|
39
|
+
return self._ingress
|
|
40
|
+
|
|
41
|
+
@property
|
|
42
|
+
def egress(self):
|
|
43
|
+
return self._egress
|
|
44
|
+
|
|
45
|
+
async def aclose(self):
|
|
46
|
+
await self._session.close()
|
livekit-api-0.2.1/livekit/api/_twirp_client.py → livekit-api-0.4.0/livekit/api/twirp_client.py
RENAMED
|
@@ -23,8 +23,16 @@ DEFAULT_PREFIX = "twirp"
|
|
|
23
23
|
|
|
24
24
|
class TwirpError(Exception):
|
|
25
25
|
def __init__(self, code: str, msg: str) -> None:
|
|
26
|
-
self.
|
|
27
|
-
self.
|
|
26
|
+
self._code = code
|
|
27
|
+
self._msg = msg
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def code(self) -> str:
|
|
31
|
+
return self._code
|
|
32
|
+
|
|
33
|
+
@property
|
|
34
|
+
def message(self) -> str:
|
|
35
|
+
return self._msg
|
|
28
36
|
|
|
29
37
|
|
|
30
38
|
class TwirpErrorCode:
|
|
@@ -59,8 +67,6 @@ class TwirpClient:
|
|
|
59
67
|
pkg: str,
|
|
60
68
|
prefix: str = DEFAULT_PREFIX,
|
|
61
69
|
) -> None:
|
|
62
|
-
self._session = aiohttp.ClientSession()
|
|
63
|
-
|
|
64
70
|
parse_res = urlparse(host)
|
|
65
71
|
scheme = parse_res.scheme
|
|
66
72
|
if scheme.startswith("ws"):
|
|
@@ -70,6 +76,7 @@ class TwirpClient:
|
|
|
70
76
|
self.host = host.rstrip("/")
|
|
71
77
|
self.pkg = pkg
|
|
72
78
|
self.prefix = prefix
|
|
79
|
+
self._session = session
|
|
73
80
|
|
|
74
81
|
async def request(
|
|
75
82
|
self,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: livekit-api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Python Server API for LiveKit
|
|
5
5
|
Home-page: https://github.com/livekit/python-sdks
|
|
6
6
|
License: Apache-2.0
|
|
@@ -19,13 +19,13 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.9
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
21
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
-
Requires-Python: >=3.
|
|
22
|
+
Requires-Python: >=3.8.0
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
Requires-Dist: pyjwt>=2.0.0
|
|
25
|
-
Requires-Dist: aiohttp>=3.
|
|
26
|
-
Requires-Dist: protobuf
|
|
27
|
-
Requires-Dist: types-protobuf
|
|
28
|
-
Requires-Dist: livekit-protocol
|
|
25
|
+
Requires-Dist: aiohttp>=3.9.0
|
|
26
|
+
Requires-Dist: protobuf==4.25.1
|
|
27
|
+
Requires-Dist: types-protobuf<5,>=4
|
|
28
|
+
Requires-Dist: livekit-protocol~=0.3.0
|
|
29
29
|
|
|
30
30
|
# LiveKit Server APIs
|
|
31
31
|
|
|
@@ -3,12 +3,12 @@ pyproject.toml
|
|
|
3
3
|
setup.py
|
|
4
4
|
livekit/api/__init__.py
|
|
5
5
|
livekit/api/_service.py
|
|
6
|
-
livekit/api/_twirp_client.py
|
|
7
6
|
livekit/api/access_token.py
|
|
8
7
|
livekit/api/egress_service.py
|
|
9
8
|
livekit/api/ingress_service.py
|
|
10
9
|
livekit/api/livekit_api.py
|
|
11
10
|
livekit/api/room_service.py
|
|
11
|
+
livekit/api/twirp_client.py
|
|
12
12
|
livekit/api/version.py
|
|
13
13
|
livekit/api/webhook.py
|
|
14
14
|
livekit_api.egg-info/PKG-INFO
|
|
@@ -46,13 +46,13 @@ setuptools.setup(
|
|
|
46
46
|
keywords=["webrtc", "realtime", "audio", "video", "livekit"],
|
|
47
47
|
license="Apache-2.0",
|
|
48
48
|
packages=setuptools.find_namespace_packages(include=["livekit.*"]),
|
|
49
|
-
python_requires=">=3.
|
|
49
|
+
python_requires=">=3.8.0",
|
|
50
50
|
install_requires=[
|
|
51
51
|
"pyjwt>=2.0.0",
|
|
52
|
-
"aiohttp>=3.
|
|
53
|
-
"protobuf
|
|
54
|
-
"types-protobuf>=
|
|
55
|
-
"livekit-protocol
|
|
52
|
+
"aiohttp>=3.9.0",
|
|
53
|
+
"protobuf==4.25.1",
|
|
54
|
+
"types-protobuf>=4,<5",
|
|
55
|
+
"livekit-protocol~=0.3.0",
|
|
56
56
|
],
|
|
57
57
|
package_data={
|
|
58
58
|
"livekit.api": ["py.typed", "*.pyi", "**/*.pyi"],
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import aiohttp
|
|
2
|
-
import os
|
|
3
|
-
from .room_service import RoomService
|
|
4
|
-
from .egress_service import EgressService
|
|
5
|
-
from .ingress_service import IngressService
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class LiveKitAPI:
|
|
9
|
-
def __init__(
|
|
10
|
-
self,
|
|
11
|
-
url: str = os.getenv("LIVEKIT_URL", "http://localhost:7880"),
|
|
12
|
-
api_key: str = os.getenv("LIVEKIT_API_KEY", ""),
|
|
13
|
-
api_secret: str = os.getenv("LIVEKIT_API_SECRET", ""),
|
|
14
|
-
*,
|
|
15
|
-
timeout: float = 60, # 1 minutes by default
|
|
16
|
-
):
|
|
17
|
-
self._session = aiohttp.ClientSession(timeout=timeout)
|
|
18
|
-
self._room = RoomService(url, api_key, api_secret, self._session)
|
|
19
|
-
self._ingress = IngressService(url, api_key, api_secret, self._session)
|
|
20
|
-
self._egress = EgressService(url, api_key, api_secret, self._session)
|
|
21
|
-
|
|
22
|
-
@property
|
|
23
|
-
def room(self):
|
|
24
|
-
return self._room
|
|
25
|
-
|
|
26
|
-
@property
|
|
27
|
-
def ingress(self):
|
|
28
|
-
return self._ingress
|
|
29
|
-
|
|
30
|
-
@property
|
|
31
|
-
def egress(self):
|
|
32
|
-
return self._egress
|
|
33
|
-
|
|
34
|
-
async def aclose(self):
|
|
35
|
-
await self._session.close()
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|