Skip to content

Commit bc3634d

Browse files
committed
Add webhook helper
1 parent d446827 commit bc3634d

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

src/elevenlabs/client.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from .environment import ElevenLabsEnvironment
1818
from .realtime_tts import RealtimeTextToSpeechClient
1919
from .types import OutputFormat
20+
from .webhooks import WebhooksClient
2021

2122

2223
DEFAULT_VOICE = Voice(
@@ -122,6 +123,7 @@ def __init__(
122123
httpx_client=httpx_client
123124
)
124125
self.text_to_speech = RealtimeTextToSpeechClient(client_wrapper=self._client_wrapper)
126+
self.webhooks = WebhooksClient()
125127

126128
@deprecated
127129
def clone(
@@ -303,6 +305,29 @@ class AsyncElevenLabs(AsyncBaseElevenLabs):
303305
)
304306
"""
305307

308+
def __init__(
309+
self,
310+
*,
311+
base_url: typing.Optional[str] = None,
312+
environment: ElevenLabsEnvironment = ElevenLabsEnvironment.PRODUCTION,
313+
api_key: typing.Optional[str] = os.getenv("ELEVENLABS_API_KEY"),
314+
timeout: typing.Optional[float] = 60,
315+
httpx_client: typing.Optional[httpx.AsyncClient] = None
316+
):
317+
super().__init__(
318+
environment=base_url
319+
and ElevenLabsEnvironment(
320+
base=f"https://{get_base_url_host(base_url)}",
321+
wss=f"wss://{get_base_url_host(base_url)}",
322+
)
323+
or environment,
324+
api_key=api_key,
325+
timeout=timeout,
326+
httpx_client=httpx_client
327+
)
328+
self.text_to_speech = RealtimeTextToSpeechClient(client_wrapper=self._client_wrapper)
329+
self.webhooks = WebhooksClient()
330+
306331
@deprecated_async
307332
async def clone(
308333
self,

src/elevenlabs/webhooks.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import hashlib
44
import time
55
from typing import Any, Dict
6-
76
from .errors import BadRequestError
87

98

0 commit comments

Comments
 (0)