speechify-api 1.1.0__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. {speechify_api-1.1.0 → speechify_api-1.2.0}/PKG-INFO +1 -1
  2. {speechify_api-1.1.0 → speechify_api-1.2.0}/pyproject.toml +1 -1
  3. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/core/client_wrapper.py +1 -1
  4. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/__init__.py +9 -1
  5. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/audio/client.py +4 -20
  6. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/errors/__init__.py +9 -1
  7. speechify_api-1.2.0/src/speechify/tts/errors/unauthorized_error.py +9 -0
  8. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/voices/client.py +153 -0
  9. {speechify_api-1.1.0 → speechify_api-1.2.0}/README.md +0 -0
  10. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/__init__.py +0 -0
  11. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/api/__init__.py +0 -0
  12. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/api/types/__init__.py +0 -0
  13. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/api/types/audio_stream_request_accept.py +0 -0
  14. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/client.py +0 -0
  15. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/core/__init__.py +0 -0
  16. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/core/api_error.py +0 -0
  17. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/core/datetime_utils.py +0 -0
  18. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/core/file.py +0 -0
  19. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/core/http_client.py +0 -0
  20. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/core/jsonable_encoder.py +0 -0
  21. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/core/pydantic_utilities.py +0 -0
  22. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/core/query_encoder.py +0 -0
  23. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/core/remove_none_from_dict.py +0 -0
  24. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/core/request_options.py +0 -0
  25. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/core/serialization.py +0 -0
  26. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/environment.py +0 -0
  27. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/py.typed +0 -0
  28. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/audio/__init__.py +0 -0
  29. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/audio/types/__init__.py +0 -0
  30. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/audio/types/audio_stream_request_accept.py +0 -0
  31. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/audio/types/get_speech_request_audio_format.py +0 -0
  32. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/audio/types/get_speech_request_model.py +0 -0
  33. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/audio/types/get_stream_request_model.py +0 -0
  34. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/auth/__init__.py +0 -0
  35. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/auth/client.py +0 -0
  36. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/auth/types/__init__.py +0 -0
  37. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/auth/types/create_access_token_request_scope.py +0 -0
  38. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/client.py +0 -0
  39. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/errors/bad_request_error.py +0 -0
  40. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/errors/forbidden_error.py +0 -0
  41. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/errors/internal_server_error.py +0 -0
  42. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/errors/not_found_error.py +0 -0
  43. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/errors/payment_required_error.py +0 -0
  44. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/__init__.py +0 -0
  45. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/access_token.py +0 -0
  46. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/access_token_scope.py +0 -0
  47. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/api_key.py +0 -0
  48. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/create_voice_language.py +0 -0
  49. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/create_voice_model.py +0 -0
  50. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/create_voice_model_name.py +0 -0
  51. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/created_voice.py +0 -0
  52. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/created_voice_gender.py +0 -0
  53. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/created_voice_type.py +0 -0
  54. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/experimental_stream_request.py +0 -0
  55. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/experimental_stream_request_model.py +0 -0
  56. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/experimental_stream_response.py +0 -0
  57. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/get_speech_options_request.py +0 -0
  58. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/get_speech_response.py +0 -0
  59. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/get_speech_response_audio_format.py +0 -0
  60. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/get_stream_options_request.py +0 -0
  61. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/get_voice.py +0 -0
  62. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/get_voice_gender.py +0 -0
  63. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/get_voice_language.py +0 -0
  64. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/get_voice_type.py +0 -0
  65. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/get_voices_model.py +0 -0
  66. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/get_voices_model_name.py +0 -0
  67. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/nested_chunk.py +0 -0
  68. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/o_auth_error.py +0 -0
  69. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/o_auth_error_error.py +0 -0
  70. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/types/speech_marks.py +0 -0
  71. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/voices/__init__.py +0 -0
  72. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/voices/types/__init__.py +0 -0
  73. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/tts/voices/types/voices_create_request_gender.py +0 -0
  74. {speechify_api-1.1.0 → speechify_api-1.2.0}/src/speechify/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: speechify-api
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary: Official Speechify API SDK
5
5
  Keywords: speechify,ai,api,sdk,text-to-speech,tts
6
6
  Author: Speechify
@@ -3,7 +3,7 @@ name = "speechify-api"
3
3
 
4
4
  [tool.poetry]
5
5
  name = "speechify-api"
6
- version = "1.1.0"
6
+ version = "1.2.0"
7
7
  description = "Official Speechify API SDK"
8
8
  readme = "README.md"
9
9
  authors = [
@@ -22,7 +22,7 @@ class BaseClientWrapper:
22
22
  headers: typing.Dict[str, str] = {
23
23
  "X-Fern-Language": "Python",
24
24
  "X-Fern-SDK-Name": "speechify-api",
25
- "X-Fern-SDK-Version": "1.1.0",
25
+ "X-Fern-SDK-Version": "1.2.0",
26
26
  }
27
27
  headers["Authorization"] = f"Bearer {self._get_token()}"
28
28
  return headers
@@ -28,7 +28,14 @@ from .types import (
28
28
  OAuthErrorError,
29
29
  SpeechMarks,
30
30
  )
31
- from .errors import BadRequestError, ForbiddenError, InternalServerError, NotFoundError, PaymentRequiredError
31
+ from .errors import (
32
+ BadRequestError,
33
+ ForbiddenError,
34
+ InternalServerError,
35
+ NotFoundError,
36
+ PaymentRequiredError,
37
+ UnauthorizedError,
38
+ )
32
39
  from . import audio, auth, voices
33
40
  from .audio import AudioStreamRequestAccept, GetSpeechRequestAudioFormat, GetSpeechRequestModel, GetStreamRequestModel
34
41
  from .auth import CreateAccessTokenRequestScope
@@ -71,6 +78,7 @@ __all__ = [
71
78
  "OAuthErrorError",
72
79
  "PaymentRequiredError",
73
80
  "SpeechMarks",
81
+ "UnauthorizedError",
74
82
  "VoicesCreateRequestGender",
75
83
  "audio",
76
84
  "auth",
@@ -60,11 +60,7 @@ class AudioClient:
60
60
  Please refer to the list of the supported languages and recommendations regarding this parameter: https://docs.sws.speechify.com/docs/language-support.
61
61
 
62
62
  model : typing.Optional[GetSpeechRequestModel]
63
- Model used for audio synthesis
64
- simba-base ModelBase ModelBase is deprecated. Use simba-english or simba-multilingual instead. @deprecated
65
- simba-english ModelEnglish
66
- simba-multilingual ModelMultilingual
67
- simba-turbo ModelTurbo
63
+ Model used for audio synthesis. `simba-base` and `simba-turbo` are deprecated. Use `simba-english` or `simba-multilingual` instead.
68
64
 
69
65
  options : typing.Optional[GetSpeechOptionsRequest]
70
66
 
@@ -192,11 +188,7 @@ class AudioClient:
192
188
  Please refer to the list of the supported languages and recommendations regarding this parameter: https://docs.sws.speechify.com/docs/language-support.
193
189
 
194
190
  model : typing.Optional[GetStreamRequestModel]
195
- Model used for audio synthesis
196
- simba-base ModelBase ModelBase is deprecated. Use simba-english or simba-multilingual instead. @deprecated
197
- simba-english ModelEnglish
198
- simba-multilingual ModelMultilingual
199
- simba-turbo ModelTurbo
191
+ Model used for audio synthesis. `simba-base` and `simba-turbo` are deprecated. Use `simba-english` or `simba-multilingual` instead.
200
192
 
201
193
  options : typing.Optional[GetStreamOptionsRequest]
202
194
 
@@ -316,11 +308,7 @@ class AsyncAudioClient:
316
308
  Please refer to the list of the supported languages and recommendations regarding this parameter: https://docs.sws.speechify.com/docs/language-support.
317
309
 
318
310
  model : typing.Optional[GetSpeechRequestModel]
319
- Model used for audio synthesis
320
- simba-base ModelBase ModelBase is deprecated. Use simba-english or simba-multilingual instead. @deprecated
321
- simba-english ModelEnglish
322
- simba-multilingual ModelMultilingual
323
- simba-turbo ModelTurbo
311
+ Model used for audio synthesis. `simba-base` and `simba-turbo` are deprecated. Use `simba-english` or `simba-multilingual` instead.
324
312
 
325
313
  options : typing.Optional[GetSpeechOptionsRequest]
326
314
 
@@ -456,11 +444,7 @@ class AsyncAudioClient:
456
444
  Please refer to the list of the supported languages and recommendations regarding this parameter: https://docs.sws.speechify.com/docs/language-support.
457
445
 
458
446
  model : typing.Optional[GetStreamRequestModel]
459
- Model used for audio synthesis
460
- simba-base ModelBase ModelBase is deprecated. Use simba-english or simba-multilingual instead. @deprecated
461
- simba-english ModelEnglish
462
- simba-multilingual ModelMultilingual
463
- simba-turbo ModelTurbo
447
+ Model used for audio synthesis. `simba-base` and `simba-turbo` are deprecated. Use `simba-english` or `simba-multilingual` instead.
464
448
 
465
449
  options : typing.Optional[GetStreamOptionsRequest]
466
450
 
@@ -5,5 +5,13 @@ from .forbidden_error import ForbiddenError
5
5
  from .internal_server_error import InternalServerError
6
6
  from .not_found_error import NotFoundError
7
7
  from .payment_required_error import PaymentRequiredError
8
+ from .unauthorized_error import UnauthorizedError
8
9
 
9
- __all__ = ["BadRequestError", "ForbiddenError", "InternalServerError", "NotFoundError", "PaymentRequiredError"]
10
+ __all__ = [
11
+ "BadRequestError",
12
+ "ForbiddenError",
13
+ "InternalServerError",
14
+ "NotFoundError",
15
+ "PaymentRequiredError",
16
+ "UnauthorizedError",
17
+ ]
@@ -0,0 +1,9 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ...core.api_error import ApiError
4
+ import typing
5
+
6
+
7
+ class UnauthorizedError(ApiError):
8
+ def __init__(self, body: typing.Optional[typing.Any]):
9
+ super().__init__(status_code=401, body=body)
@@ -15,6 +15,7 @@ from ..types.created_voice import CreatedVoice
15
15
  from ..errors.bad_request_error import BadRequestError
16
16
  from ..errors.payment_required_error import PaymentRequiredError
17
17
  from ...core.jsonable_encoder import jsonable_encoder
18
+ from ..errors.unauthorized_error import UnauthorizedError
18
19
  from ...core.client_wrapper import AsyncClientWrapper
19
20
 
20
21
  # this is used as the default value for optional parameters
@@ -277,6 +278,82 @@ class VoicesClient:
277
278
  raise ApiError(status_code=_response.status_code, body=_response.text)
278
279
  raise ApiError(status_code=_response.status_code, body=_response_json)
279
280
 
281
+ def download_sample(
282
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
283
+ ) -> typing.Iterator[bytes]:
284
+ """
285
+ Download a personal (cloned) voice sample
286
+
287
+ Parameters
288
+ ----------
289
+ id : str
290
+ The ID of the voice to download sample for
291
+
292
+ request_options : typing.Optional[RequestOptions]
293
+ Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
294
+
295
+ Yields
296
+ ------
297
+ typing.Iterator[bytes]
298
+ Voice sample audio file
299
+ """
300
+ with self._client_wrapper.httpx_client.stream(
301
+ f"v1/voices/{jsonable_encoder(id)}/sample",
302
+ method="GET",
303
+ request_options=request_options,
304
+ ) as _response:
305
+ try:
306
+ if 200 <= _response.status_code < 300:
307
+ _chunk_size = request_options.get("chunk_size", None) if request_options is not None else None
308
+ for _chunk in _response.iter_bytes(chunk_size=_chunk_size):
309
+ yield _chunk
310
+ return
311
+ _response.read()
312
+ if _response.status_code == 400:
313
+ raise BadRequestError(
314
+ typing.cast(
315
+ typing.Optional[typing.Any],
316
+ parse_obj_as(
317
+ type_=typing.Optional[typing.Any], # type: ignore
318
+ object_=_response.json(),
319
+ ),
320
+ )
321
+ )
322
+ if _response.status_code == 401:
323
+ raise UnauthorizedError(
324
+ typing.cast(
325
+ typing.Optional[typing.Any],
326
+ parse_obj_as(
327
+ type_=typing.Optional[typing.Any], # type: ignore
328
+ object_=_response.json(),
329
+ ),
330
+ )
331
+ )
332
+ if _response.status_code == 404:
333
+ raise NotFoundError(
334
+ typing.cast(
335
+ typing.Optional[typing.Any],
336
+ parse_obj_as(
337
+ type_=typing.Optional[typing.Any], # type: ignore
338
+ object_=_response.json(),
339
+ ),
340
+ )
341
+ )
342
+ if _response.status_code == 500:
343
+ raise InternalServerError(
344
+ typing.cast(
345
+ typing.Optional[typing.Any],
346
+ parse_obj_as(
347
+ type_=typing.Optional[typing.Any], # type: ignore
348
+ object_=_response.json(),
349
+ ),
350
+ )
351
+ )
352
+ _response_json = _response.json()
353
+ except JSONDecodeError:
354
+ raise ApiError(status_code=_response.status_code, body=_response.text)
355
+ raise ApiError(status_code=_response.status_code, body=_response_json)
356
+
280
357
 
281
358
  class AsyncVoicesClient:
282
359
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -557,3 +634,79 @@ class AsyncVoicesClient:
557
634
  except JSONDecodeError:
558
635
  raise ApiError(status_code=_response.status_code, body=_response.text)
559
636
  raise ApiError(status_code=_response.status_code, body=_response_json)
637
+
638
+ async def download_sample(
639
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
640
+ ) -> typing.AsyncIterator[bytes]:
641
+ """
642
+ Download a personal (cloned) voice sample
643
+
644
+ Parameters
645
+ ----------
646
+ id : str
647
+ The ID of the voice to download sample for
648
+
649
+ request_options : typing.Optional[RequestOptions]
650
+ Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
651
+
652
+ Yields
653
+ ------
654
+ typing.AsyncIterator[bytes]
655
+ Voice sample audio file
656
+ """
657
+ async with self._client_wrapper.httpx_client.stream(
658
+ f"v1/voices/{jsonable_encoder(id)}/sample",
659
+ method="GET",
660
+ request_options=request_options,
661
+ ) as _response:
662
+ try:
663
+ if 200 <= _response.status_code < 300:
664
+ _chunk_size = request_options.get("chunk_size", None) if request_options is not None else None
665
+ async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size):
666
+ yield _chunk
667
+ return
668
+ await _response.aread()
669
+ if _response.status_code == 400:
670
+ raise BadRequestError(
671
+ typing.cast(
672
+ typing.Optional[typing.Any],
673
+ parse_obj_as(
674
+ type_=typing.Optional[typing.Any], # type: ignore
675
+ object_=_response.json(),
676
+ ),
677
+ )
678
+ )
679
+ if _response.status_code == 401:
680
+ raise UnauthorizedError(
681
+ typing.cast(
682
+ typing.Optional[typing.Any],
683
+ parse_obj_as(
684
+ type_=typing.Optional[typing.Any], # type: ignore
685
+ object_=_response.json(),
686
+ ),
687
+ )
688
+ )
689
+ if _response.status_code == 404:
690
+ raise NotFoundError(
691
+ typing.cast(
692
+ typing.Optional[typing.Any],
693
+ parse_obj_as(
694
+ type_=typing.Optional[typing.Any], # type: ignore
695
+ object_=_response.json(),
696
+ ),
697
+ )
698
+ )
699
+ if _response.status_code == 500:
700
+ raise InternalServerError(
701
+ typing.cast(
702
+ typing.Optional[typing.Any],
703
+ parse_obj_as(
704
+ type_=typing.Optional[typing.Any], # type: ignore
705
+ object_=_response.json(),
706
+ ),
707
+ )
708
+ )
709
+ _response_json = _response.json()
710
+ except JSONDecodeError:
711
+ raise ApiError(status_code=_response.status_code, body=_response.text)
712
+ raise ApiError(status_code=_response.status_code, body=_response_json)
File without changes