Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion livekit-api/livekit/api/_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class Service(ABC):
def __init__(
self, host: str, api_key: str, api_secret: str, session: aiohttp.ClientSession
self, session: aiohttp.ClientSession, host: str, api_key: str, api_secret: str
):
self._client = TwirpClient(session, host, "livekit")
self.api_key = api_key
Expand Down
3 changes: 1 addition & 2 deletions livekit-api/livekit/api/_twirp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ def __init__(
pkg: str,
prefix: str = DEFAULT_PREFIX,
) -> None:
self._session = aiohttp.ClientSession()

parse_res = urlparse(host)
scheme = parse_res.scheme
if scheme.startswith("ws"):
Expand All @@ -70,6 +68,7 @@ def __init__(
self.host = host.rstrip("/")
self.pkg = pkg
self.prefix = prefix
self._session = session

async def request(
self,
Expand Down
8 changes: 4 additions & 4 deletions livekit-api/livekit/api/livekit_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(
api_key: Optional[str] = None,
api_secret: Optional[str] = None,
*,
timeout: float = 60, # 1 minutes by default
timeout: aiohttp.ClientTimeout = aiohttp.ClientTimeout(total=60), # 60 seconds
):
url = url or os.getenv("LIVEKIT_URL")
api_key = api_key or os.getenv("LIVEKIT_API_KEY")
Expand All @@ -26,9 +26,9 @@ def __init__(
raise ValueError("api_key and api_secret must be set")

self._session = aiohttp.ClientSession(timeout=timeout)
self._room = RoomService(url, api_key, api_secret, self._session)
self._ingress = IngressService(url, api_key, api_secret, self._session)
self._egress = EgressService(url, api_key, api_secret, self._session)
self._room = RoomService(self._session, url, api_key, api_secret)
self._ingress = IngressService(self._session, url, api_key, api_secret)
self._egress = EgressService(self._session, url, api_key, api_secret)

@property
def room(self):
Expand Down
2 changes: 1 addition & 1 deletion livekit-api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
python_requires=">=3.7.0",
install_requires=[
"pyjwt>=2.0.0",
"aiohttp>=3.8.0",
"aiohttp>=3.9.0",
"protobuf>=3.1.0",
"types-protobuf>=3.1.0",
"livekit-protocol>=0.2.0",
Expand Down