spitch 1.4.0__py3-none-any.whl → 1.6.0__py3-none-any.whl
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.
Potentially problematic release.
This version of spitch might be problematic. Click here for more details.
- spitch/_base_client.py +8 -1
- spitch/_version.py +1 -1
- spitch/resources/speech.py +2 -2
- spitch/types/speech_generate_params.py +1 -1
- {spitch-1.4.0.dist-info → spitch-1.6.0.dist-info}/METADATA +23 -9
- {spitch-1.4.0.dist-info → spitch-1.6.0.dist-info}/RECORD +8 -8
- {spitch-1.4.0.dist-info → spitch-1.6.0.dist-info}/WHEEL +0 -0
- {spitch-1.4.0.dist-info → spitch-1.6.0.dist-info}/licenses/LICENSE +0 -0
spitch/_base_client.py
CHANGED
|
@@ -143,6 +143,12 @@ class PageInfo:
|
|
|
143
143
|
self.url = url
|
|
144
144
|
self.params = params
|
|
145
145
|
|
|
146
|
+
@override
|
|
147
|
+
def __repr__(self) -> str:
|
|
148
|
+
if self.url:
|
|
149
|
+
return f"{self.__class__.__name__}(url={self.url})"
|
|
150
|
+
return f"{self.__class__.__name__}(params={self.params})"
|
|
151
|
+
|
|
146
152
|
|
|
147
153
|
class BasePage(GenericModel, Generic[_T]):
|
|
148
154
|
"""
|
|
@@ -689,7 +695,8 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
689
695
|
if retry_after is not None and 0 < retry_after <= 60:
|
|
690
696
|
return retry_after
|
|
691
697
|
|
|
692
|
-
|
|
698
|
+
# Also cap retry count to 1000 to avoid any potential overflows with `pow`
|
|
699
|
+
nb_retries = min(max_retries - remaining_retries, 1000)
|
|
693
700
|
|
|
694
701
|
# Apply exponential backoff, but not more than the max.
|
|
695
702
|
sleep_seconds = min(INITIAL_RETRY_DELAY * pow(2.0, nb_retries), MAX_RETRY_DELAY)
|
spitch/_version.py
CHANGED
spitch/resources/speech.py
CHANGED
|
@@ -61,7 +61,7 @@ class SpeechResource(SyncAPIResource):
|
|
|
61
61
|
*,
|
|
62
62
|
language: Literal["yo", "en", "ha", "ig"],
|
|
63
63
|
text: str,
|
|
64
|
-
voice: Literal["sade", "segun", "femi", "funmi"]
|
|
64
|
+
voice: Literal["sade", "segun", "femi", "funmi"],
|
|
65
65
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
66
66
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
67
67
|
extra_headers: Headers | None = None,
|
|
@@ -171,7 +171,7 @@ class AsyncSpeechResource(AsyncAPIResource):
|
|
|
171
171
|
*,
|
|
172
172
|
language: Literal["yo", "en", "ha", "ig"],
|
|
173
173
|
text: str,
|
|
174
|
-
voice: Literal["sade", "segun", "femi", "funmi"]
|
|
174
|
+
voice: Literal["sade", "segun", "femi", "funmi"],
|
|
175
175
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
176
176
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
177
177
|
extra_headers: Headers | None = None,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: spitch
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.0
|
|
4
4
|
Summary: The official Python library for the spitch API
|
|
5
5
|
Project-URL: Homepage, https://github.com/spi-tch/spitch-python
|
|
6
6
|
Project-URL: Repository, https://github.com/spi-tch/spitch-python
|
|
@@ -66,8 +66,10 @@ client = Spitch(
|
|
|
66
66
|
api_key=os.environ.get("SPITCH_API_KEY"),
|
|
67
67
|
)
|
|
68
68
|
|
|
69
|
-
response = client.speech.
|
|
69
|
+
response = client.speech.generate(
|
|
70
70
|
language="yo",
|
|
71
|
+
text="text",
|
|
72
|
+
voice="sade",
|
|
71
73
|
)
|
|
72
74
|
```
|
|
73
75
|
|
|
@@ -92,8 +94,10 @@ client = AsyncSpitch(
|
|
|
92
94
|
|
|
93
95
|
|
|
94
96
|
async def main() -> None:
|
|
95
|
-
response = await client.speech.
|
|
97
|
+
response = await client.speech.generate(
|
|
96
98
|
language="yo",
|
|
99
|
+
text="text",
|
|
100
|
+
voice="sade",
|
|
97
101
|
)
|
|
98
102
|
|
|
99
103
|
|
|
@@ -127,8 +131,10 @@ from spitch import Spitch
|
|
|
127
131
|
client = Spitch()
|
|
128
132
|
|
|
129
133
|
try:
|
|
130
|
-
client.speech.
|
|
134
|
+
client.speech.generate(
|
|
131
135
|
language="yo",
|
|
136
|
+
text="text",
|
|
137
|
+
voice="sade",
|
|
132
138
|
)
|
|
133
139
|
except spitch.APIConnectionError as e:
|
|
134
140
|
print("The server could not be reached")
|
|
@@ -172,8 +178,10 @@ client = Spitch(
|
|
|
172
178
|
)
|
|
173
179
|
|
|
174
180
|
# Or, configure per-request:
|
|
175
|
-
client.with_options(max_retries=5).speech.
|
|
181
|
+
client.with_options(max_retries=5).speech.generate(
|
|
176
182
|
language="yo",
|
|
183
|
+
text="text",
|
|
184
|
+
voice="sade",
|
|
177
185
|
)
|
|
178
186
|
```
|
|
179
187
|
|
|
@@ -197,8 +205,10 @@ client = Spitch(
|
|
|
197
205
|
)
|
|
198
206
|
|
|
199
207
|
# Override per-request:
|
|
200
|
-
client.with_options(timeout=5.0).speech.
|
|
208
|
+
client.with_options(timeout=5.0).speech.generate(
|
|
201
209
|
language="yo",
|
|
210
|
+
text="text",
|
|
211
|
+
voice="sade",
|
|
202
212
|
)
|
|
203
213
|
```
|
|
204
214
|
|
|
@@ -238,12 +248,14 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
|
238
248
|
from spitch import Spitch
|
|
239
249
|
|
|
240
250
|
client = Spitch()
|
|
241
|
-
response = client.speech.with_raw_response.
|
|
251
|
+
response = client.speech.with_raw_response.generate(
|
|
242
252
|
language="yo",
|
|
253
|
+
text="text",
|
|
254
|
+
voice="sade",
|
|
243
255
|
)
|
|
244
256
|
print(response.headers.get('X-My-Header'))
|
|
245
257
|
|
|
246
|
-
speech = response.parse() # get the object that `speech.
|
|
258
|
+
speech = response.parse() # get the object that `speech.generate()` would have returned
|
|
247
259
|
print(speech)
|
|
248
260
|
```
|
|
249
261
|
|
|
@@ -258,8 +270,10 @@ The above interface eagerly reads the full response body when you make the reque
|
|
|
258
270
|
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
|
259
271
|
|
|
260
272
|
```python
|
|
261
|
-
with client.speech.with_streaming_response.
|
|
273
|
+
with client.speech.with_streaming_response.generate(
|
|
262
274
|
language="yo",
|
|
275
|
+
text="text",
|
|
276
|
+
voice="sade",
|
|
263
277
|
) as response:
|
|
264
278
|
print(response.headers.get("X-My-Header"))
|
|
265
279
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
spitch/__init__.py,sha256=mBQhmNu88PeR66Zmw9atnzuU8f1mpSPcW7vn-EeSikE,2399
|
|
2
|
-
spitch/_base_client.py,sha256=
|
|
2
|
+
spitch/_base_client.py,sha256=PLtLHoOh2kn4Bpm-5tYKIUrVqbuD0UWr1BKuhnGwUXU,67840
|
|
3
3
|
spitch/_client.py,sha256=wnexAmnaiafFtJM7PC9LyThw3aIkI6eLn7ZReCL2iLY,15446
|
|
4
4
|
spitch/_compat.py,sha256=9CWnEaYK0kot7aSNW-m2W9xZb5giIdvKN9sWxvBbbSA,6488
|
|
5
5
|
spitch/_constants.py,sha256=JE8kyZa2Q4NK_i4fO--8siEYTzeHnT0fYbOFDgDP4uk,464
|
|
@@ -11,7 +11,7 @@ spitch/_resource.py,sha256=TLFPcOOmtxZOQLh3XCNPB_BdrQpp0MIYoKoH52aRAu8,1100
|
|
|
11
11
|
spitch/_response.py,sha256=aN6swtguiZ7CC_hWFrwoUa53FgSbjRfZXxYHvfDNGeo,28609
|
|
12
12
|
spitch/_streaming.py,sha256=5SpId2EIfF8Ee8UUYmJxqgHUGP1ZdHCUHhHCdNJREFA,10100
|
|
13
13
|
spitch/_types.py,sha256=dsJyGWdBXaYJaRBqn2V3iRsfpWw71rFaSxdSM8sPQYY,6103
|
|
14
|
-
spitch/_version.py,sha256=
|
|
14
|
+
spitch/_version.py,sha256=du9OwxylX7WRG8VPP97XEsjL0NX2FF6uLkflVNNHIQg,158
|
|
15
15
|
spitch/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
spitch/_utils/__init__.py,sha256=Uzq1-FIih_VUjzdNVWXks0sdC39KBKLMrZoz-_JOjJ4,1988
|
|
17
17
|
spitch/_utils/_logs.py,sha256=ApRyYK_WgZfEr_ygBUBXWMlTgeMr2tdNOGlH8jE4oJc,774
|
|
@@ -24,13 +24,13 @@ spitch/_utils/_typing.py,sha256=tFbktdpdHCQliwzGsWysgn0P5H0JRdagkZdb_LegGkY,3838
|
|
|
24
24
|
spitch/_utils/_utils.py,sha256=tYrr7IX-5NMwsVKbNggbzOM84uNw7XnAe06e2Ln8Or0,11472
|
|
25
25
|
spitch/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
|
26
26
|
spitch/resources/__init__.py,sha256=KT6rAvIlWHQk9QdM4Jp8ABziKILaBrrtiO7LCB5Wa5E,976
|
|
27
|
-
spitch/resources/speech.py,sha256=
|
|
27
|
+
spitch/resources/speech.py,sha256=JUMxsdL88Sr8FBWZ7yltYV5KPX7fN7N_UW4dH5LtSzw,11342
|
|
28
28
|
spitch/resources/text.py,sha256=xy7N1q5ioXVMtmcW6iOE8j8n9j4lvnpvO4jJ9FMZmsU,6071
|
|
29
29
|
spitch/types/__init__.py,sha256=4aa9CgcCmGRqZb4k9F3005Q4Ok-zjiiqw5k3BXIQ3MY,364
|
|
30
|
-
spitch/types/speech_generate_params.py,sha256=
|
|
30
|
+
spitch/types/speech_generate_params.py,sha256=cZjZhlP9CIuwRQEnsAiBCurPEIlLgVBTYxx98hQViHg,417
|
|
31
31
|
spitch/types/speech_transcibe_params.py,sha256=WvwBsSctqJDXOFJNYyjfijwCnAdJCPkJobESfmLy3aI,448
|
|
32
32
|
spitch/types/text_tone_mark_params.py,sha256=63P5VElxanYkDP1ZLEuQt97JSgVpMCaAo4WRWLDvhlY,349
|
|
33
|
-
spitch-1.
|
|
34
|
-
spitch-1.
|
|
35
|
-
spitch-1.
|
|
36
|
-
spitch-1.
|
|
33
|
+
spitch-1.6.0.dist-info/METADATA,sha256=MSdm2bE2YDyuALkrzx08mdSgPKJgmgr03ZsXr7eBT_4,12645
|
|
34
|
+
spitch-1.6.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
35
|
+
spitch-1.6.0.dist-info/licenses/LICENSE,sha256=529F8Amq5MfoIm33JY544oweKES9vw9_xS1CNx-ztPI,11336
|
|
36
|
+
spitch-1.6.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|