Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
fix: pusher auth endpoint and parameter
angrybayblade71bfc1cdfeeb
diff --git a/python/composio/constants.py b/python/composio/constants.pydeleted file mode 100644index 4ae6389f9..000000000--- a/python/composio/constants.py+++ /dev/null@@ -1,9 +0,0 @@-PUSHER_KEY = "8e1b8c92b7f8b2151c15"-"""-API Key for Pusher subscriptions.-"""--PUSHER_CLUSTER = "mt1"-"""-Name of the pusher cluster.-"""diff --git a/python/composio/core/models/triggers.py b/python/composio/core/models/triggers.pyindex 624967b6a..6c85a0d8f 100644--- a/python/composio/core/models/triggers.py+++ b/python/composio/core/models/triggers.py@@ -17,13 +17,12 @@ from pysher.connection import Connection as PusherConnectionfrom composio import exceptionsfrom composio.client import HttpClientfrom composio.client.types import trigger_instance_upsert_response-from composio.constants import PUSHER_CLUSTER, PUSHER_KEYfrom composio.core.models.base import Resourcefrom composio.core.models.internal import Internalfrom composio.exceptions import ComposioSDKTimeoutErrorfrom composio.utils.logging import WithLogger-PUSHER_AUTH_URL = "{base_url}/api/v3/internal/sdk/realtime/auth?fromPython=true"+PUSHER_AUTH_URL = "{base_url}/api/v3/internal/sdk/realtime/auth?source=python"class TriggerConnectedAccountSchema(t.TypedDict):@@ -267,11 +266,11 @@ class _SubcriptionBuilder(WithLogger):return _connection_handler- def _get_pusher_instance(self) -> Pusher:+ def _get_pusher_instance(self, key: str, cluster: str) -> Pusher:"""Get a pusher instance."""return Pusher(- key=PUSHER_KEY,- cluster=PUSHER_CLUSTER,+ key=key,+ cluster=cluster,auth_endpoint=PUSHER_AUTH_URL.format(base_url=self._client.base_url),auth_endpoint_headers={"x-api-key": self._client.api_key,@@ -283,8 +282,11 @@ class _SubcriptionBuilder(WithLogger):def connect(self, timeout: float = 15.0) -> TriggerSubscription:"""Connect to Pusher channel for given client ID."""self.logger.debug("Creating trigger subscription")- pusher = self._get_pusher_instance()project_info = self.internal.get_sdk_realtime_credentials()+ pusher = self._get_pusher_instance(+ key=project_info.pusher_key,+ cluster=project_info.pusher_cluster,+ )# Patch pusher loggerpusher.connection.logger = mock.MagicMock() # type: ignore@@ -328,8 +330,6 @@ class Triggers(Resource)::param client: The client to use for the triggers resource."""self._client = client- self._pusher_service = self.__init_pusher()-self.list_enum = self._client.triggers_types.retrieve_enumself.list = self._client.triggers_types.listself.delete = self._client.trigger_instances.manage.delete@@ -342,20 +342,6 @@ class Triggers(Resource):self._client.trigger_instances.manage.update,status="disable",)- self.unsubscribe = self._pusher_service.unsubscribe-- def __init_pusher(self):- """Initialize the pusher service."""- return Pusher(- key=PUSHER_KEY, # TODO: Fetch from API- cluster=PUSHER_CLUSTER, # TODO: Fetch from API- auth_endpoint=PUSHER_AUTH_URL.format(base_url=self._client.base_url),- auth_endpoint_headers={- "x-api-key": self._client.api_key,- "x-request-id": str(uuid.uuid4()),- },- auto_sub=True,- )def list_active(self,