@devries-cameron20 / composio Mirror · read-only / commits / 0e8c2f747
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 23:15 UTC

feat: add `composio.connected_accounts.wait_for_connection`

angrybayblade committed Jun 30, 2025 at 14:24 UTC 0e8c2f7476943a5c73d0078c41821ed7b17d79ac
1 file changed +25
python/composio/core/models/connected_accounts.py
+25
@@ -4,6 +4,8 @@ import functools
4 import time
5 import typing as t
6
7 +import typing_extensions as te
8 +
9 from composio import exceptions
10 from composio.client import HttpClient
11 from composio.client.types import (
@@ -68,6 +70,15 @@ class ConnectionRequest(Resource):
70 message=f"Timeout while waiting for connection {self.id} to be active",
71 )
72
73 + @classmethod
74 + def from_id(cls, id: str, client: HttpClient) -> te.Self:
75 + return cls(
76 + id=id,
77 + status=client.connected_accounts.retrieve(nanoid=id).status,
78 + redirect_url=None,
79 + client=client,
80 + )
81 +
82
83 class AuthScheme:
84 """
@@ -341,5 +352,19 @@ class ConnectedAccounts:
352 client=self._client,
353 )
354
355 + def wait_for_connection(
356 + self,
357 + id: str,
358 + timeout: t.Optional[float] = None,
359 + ) -> connected_account_retrieve_response.ConnectedAccountRetrieveResponse:
360 + """
361 + Wait for connected account with given ID to be active
362 + """
363 + return ConnectionRequest.from_id(
364 + id=id, client=self._client
365 + ).wait_for_connection(
366 + timeout=timeout,
367 + )
368 +
369
370 auth_scheme = AuthScheme()