Skip to content
Open
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
7 changes: 4 additions & 3 deletions vapi_python/vapi_python.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from daily import *
from requests.exceptions import ConnectionError
import requests
from .daily_call import DailyCall

Expand All @@ -19,7 +20,7 @@ def create_web_call(api_url, api_key, payload):
web_call_url = data.get('webCallUrl')
return call_id, web_call_url
else:
raise Exception(f"Error: {data['message']}")
raise ConnectionError(f"API Error: {data['message']}")


class Vapi:
Expand All @@ -46,13 +47,13 @@ def start(
elif squad:
payload = {'squad': squad}
else:
raise Exception("Error: No assistant specified.")
raise ValueError("Error: No assistant specified.")

call_id, web_call_url = create_web_call(
self.api_url, self.api_key, payload)

if not web_call_url:
raise Exception("Error: Unable to create call.")
raise ConnectionError("Error: Unable to create call.")

print('Joining call... ' + call_id)

Expand Down