Skip to content

Commit

Permalink
Fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kaavee315 committed Apr 24, 2024
1 parent fdc626b commit 07df691
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions core/composio/sdk/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def generate_cli_auth_session(self):
if resp.get('key'):
return resp['key']

raise Exception("Bad request to cli/generate-cli-session")
raise Exception(f"Bad request to cli/generate-cli-session. Status code: {resp.status_code}, response: {resp.text}")

def verify_cli_auth_session(self, key: str, code: str):
resp = self.http_client.get(f"{self.base_url}/v1/cli/verify-cli-code?key={key}&code={code}");
Expand All @@ -97,7 +97,7 @@ def verify_cli_auth_session(self, key: str, code: str):
elif resp.status_code == 401:
raise UnauthorizedAccessException("UnauthorizedError: Unauthorized access to cli/verify-cli-session")

raise Exception("Bad request to cli/verify-cli-session")
raise Exception(f"Bad request to cli/verify-cli-session. Status code: {resp.status_code}, response: {resp.text}")

def initiate_connection(self, appName: Union[str, App], integrationId: str = None) -> ConnectionRequest:
if integrationId is None:
Expand All @@ -112,7 +112,7 @@ def initiate_connection(self, appName: Union[str, App], integrationId: str = Non
if resp.status_code == 200:
return ConnectionRequest(self.sdk, **resp.json())

raise Exception("Failed to create connection")
raise Exception(f"Failed to create connection. Status code: {resp.status_code}, response: {resp.text}")

def set_global_trigger(self, callback_url: str):
try:
Expand Down
8 changes: 4 additions & 4 deletions core/composio/sdk/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _execute_action(
)
if resp.status_code == 200:
return resp.json()
raise Exception("Failed to execute action, response: ", resp.text)
raise Exception(f"Failed to execute action, status code: {resp.status_code}, response: {resp.text}")

def execute_action(self, action_name: Action, params: dict):
resp = self._execute_action(action_name, self.id, params)
Expand Down Expand Up @@ -133,7 +133,7 @@ def get_all_actions(self, format: SchemaFormat = SchemaFormat.OPENAI):
else:
return actions["items"]

raise Exception("Failed to get actions. You might want to run composio-cli update and restart the python notebook to reload the updated library.")
raise Exception(f"Failed to get actions. Status code: {resp.status_code}, response: {resp.text}")

def handle_tools_calls(self, tool_calls: ChatCompletion) -> list[any]:
output = []
Expand Down Expand Up @@ -195,7 +195,7 @@ def initiate_connection(
if resp.status_code == 200:
return ConnectionRequest(self.sdk_instance, **resp.json())

raise Exception("Failed to create connection")
raise Exception(f"Failed to create connection. Status code: {resp.status_code}, response: {resp.text}")

def get_required_variables(self):
return self.expectedInputFields
Expand Down Expand Up @@ -229,7 +229,7 @@ def list_active_triggers(self, trigger_ids: list[str] = None) -> list[ActiveTrig
raise Exception(f"Failed to get active triggers, status code: {resp.status_code}, response: {resp.text}")
if resp.json().get("triggers"):
return [ActiveTrigger(self, **item) for item in resp.json()["triggers"]]
raise Exception(f"Failed to get active triggers, response: {resp.text}")
raise Exception(f"Failed to get active triggers, status code: {resp.status_code}, response: {resp.text}")

def disable_trigger(self, trigger_id: str):
resp = self.http_client.post(f"{self.base_url}/v1/triggers/disable/{trigger_id}")
Expand Down

0 comments on commit 07df691

Please sign in to comment.