spitch 0.0.7__py3-none-any.whl → 1.0.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/_client.py ADDED
@@ -0,0 +1,414 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ from typing import Any, Union, Mapping
7
+ from typing_extensions import Self, override
8
+
9
+ import httpx
10
+
11
+ from . import resources, _exceptions
12
+ from ._qs import Querystring
13
+ from ._types import (
14
+ NOT_GIVEN,
15
+ Omit,
16
+ Timeout,
17
+ NotGiven,
18
+ Transport,
19
+ ProxiesTypes,
20
+ RequestOptions,
21
+ )
22
+ from ._utils import (
23
+ is_given,
24
+ get_async_library,
25
+ )
26
+ from ._version import __version__
27
+ from ._streaming import Stream as Stream, AsyncStream as AsyncStream
28
+ from ._exceptions import SpitchError, APIStatusError
29
+ from ._base_client import (
30
+ DEFAULT_MAX_RETRIES,
31
+ SyncAPIClient,
32
+ AsyncAPIClient,
33
+ )
34
+
35
+ __all__ = [
36
+ "Timeout",
37
+ "Transport",
38
+ "ProxiesTypes",
39
+ "RequestOptions",
40
+ "resources",
41
+ "Spitch",
42
+ "AsyncSpitch",
43
+ "Client",
44
+ "AsyncClient",
45
+ ]
46
+
47
+
48
+ class Spitch(SyncAPIClient):
49
+ speech: resources.SpeechResource
50
+ text: resources.TextResource
51
+ with_raw_response: SpitchWithRawResponse
52
+ with_streaming_response: SpitchWithStreamedResponse
53
+
54
+ # client options
55
+ api_key: str
56
+
57
+ def __init__(
58
+ self,
59
+ *,
60
+ api_key: str | None = None,
61
+ base_url: str | httpx.URL | None = None,
62
+ timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
63
+ max_retries: int = DEFAULT_MAX_RETRIES,
64
+ default_headers: Mapping[str, str] | None = None,
65
+ default_query: Mapping[str, object] | None = None,
66
+ # Configure a custom httpx client.
67
+ # We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`.
68
+ # See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details.
69
+ http_client: httpx.Client | None = None,
70
+ # Enable or disable schema validation for data returned by the API.
71
+ # When enabled an error APIResponseValidationError is raised
72
+ # if the API responds with invalid data for the expected schema.
73
+ #
74
+ # This parameter may be removed or changed in the future.
75
+ # If you rely on this feature, please open a GitHub issue
76
+ # outlining your use-case to help us decide if it should be
77
+ # part of our public interface in the future.
78
+ _strict_response_validation: bool = False,
79
+ ) -> None:
80
+ """Construct a new synchronous spitch client instance.
81
+
82
+ This automatically infers the `api_key` argument from the `SPITCH_API_KEY` environment variable if it is not provided.
83
+ """
84
+ if api_key is None:
85
+ api_key = os.environ.get("SPITCH_API_KEY")
86
+ if api_key is None:
87
+ raise SpitchError(
88
+ "The api_key client option must be set either by passing api_key to the client or by setting the SPITCH_API_KEY environment variable"
89
+ )
90
+ self.api_key = api_key
91
+
92
+ if base_url is None:
93
+ base_url = os.environ.get("SPITCH_BASE_URL")
94
+ if base_url is None:
95
+ base_url = f"https://api.spi-tch.com"
96
+
97
+ super().__init__(
98
+ version=__version__,
99
+ base_url=base_url,
100
+ max_retries=max_retries,
101
+ timeout=timeout,
102
+ http_client=http_client,
103
+ custom_headers=default_headers,
104
+ custom_query=default_query,
105
+ _strict_response_validation=_strict_response_validation,
106
+ )
107
+
108
+ self.speech = resources.SpeechResource(self)
109
+ self.text = resources.TextResource(self)
110
+ self.with_raw_response = SpitchWithRawResponse(self)
111
+ self.with_streaming_response = SpitchWithStreamedResponse(self)
112
+
113
+ @property
114
+ @override
115
+ def qs(self) -> Querystring:
116
+ return Querystring(array_format="comma")
117
+
118
+ @property
119
+ @override
120
+ def auth_headers(self) -> dict[str, str]:
121
+ api_key = self.api_key
122
+ return {"Authorization": f"Bearer {api_key}"}
123
+
124
+ @property
125
+ @override
126
+ def default_headers(self) -> dict[str, str | Omit]:
127
+ return {
128
+ **super().default_headers,
129
+ "X-Stainless-Async": "false",
130
+ **self._custom_headers,
131
+ }
132
+
133
+ def copy(
134
+ self,
135
+ *,
136
+ api_key: str | None = None,
137
+ base_url: str | httpx.URL | None = None,
138
+ timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
139
+ http_client: httpx.Client | None = None,
140
+ max_retries: int | NotGiven = NOT_GIVEN,
141
+ default_headers: Mapping[str, str] | None = None,
142
+ set_default_headers: Mapping[str, str] | None = None,
143
+ default_query: Mapping[str, object] | None = None,
144
+ set_default_query: Mapping[str, object] | None = None,
145
+ _extra_kwargs: Mapping[str, Any] = {},
146
+ ) -> Self:
147
+ """
148
+ Create a new client instance re-using the same options given to the current client with optional overriding.
149
+ """
150
+ if default_headers is not None and set_default_headers is not None:
151
+ raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive")
152
+
153
+ if default_query is not None and set_default_query is not None:
154
+ raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive")
155
+
156
+ headers = self._custom_headers
157
+ if default_headers is not None:
158
+ headers = {**headers, **default_headers}
159
+ elif set_default_headers is not None:
160
+ headers = set_default_headers
161
+
162
+ params = self._custom_query
163
+ if default_query is not None:
164
+ params = {**params, **default_query}
165
+ elif set_default_query is not None:
166
+ params = set_default_query
167
+
168
+ http_client = http_client or self._client
169
+ return self.__class__(
170
+ api_key=api_key or self.api_key,
171
+ base_url=base_url or self.base_url,
172
+ timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
173
+ http_client=http_client,
174
+ max_retries=max_retries if is_given(max_retries) else self.max_retries,
175
+ default_headers=headers,
176
+ default_query=params,
177
+ **_extra_kwargs,
178
+ )
179
+
180
+ # Alias for `copy` for nicer inline usage, e.g.
181
+ # client.with_options(timeout=10).foo.create(...)
182
+ with_options = copy
183
+
184
+ @override
185
+ def _make_status_error(
186
+ self,
187
+ err_msg: str,
188
+ *,
189
+ body: object,
190
+ response: httpx.Response,
191
+ ) -> APIStatusError:
192
+ if response.status_code == 400:
193
+ return _exceptions.BadRequestError(err_msg, response=response, body=body)
194
+
195
+ if response.status_code == 401:
196
+ return _exceptions.AuthenticationError(err_msg, response=response, body=body)
197
+
198
+ if response.status_code == 403:
199
+ return _exceptions.PermissionDeniedError(err_msg, response=response, body=body)
200
+
201
+ if response.status_code == 404:
202
+ return _exceptions.NotFoundError(err_msg, response=response, body=body)
203
+
204
+ if response.status_code == 409:
205
+ return _exceptions.ConflictError(err_msg, response=response, body=body)
206
+
207
+ if response.status_code == 422:
208
+ return _exceptions.UnprocessableEntityError(err_msg, response=response, body=body)
209
+
210
+ if response.status_code == 429:
211
+ return _exceptions.RateLimitError(err_msg, response=response, body=body)
212
+
213
+ if response.status_code >= 500:
214
+ return _exceptions.InternalServerError(err_msg, response=response, body=body)
215
+ return APIStatusError(err_msg, response=response, body=body)
216
+
217
+
218
+ class AsyncSpitch(AsyncAPIClient):
219
+ speech: resources.AsyncSpeechResource
220
+ text: resources.AsyncTextResource
221
+ with_raw_response: AsyncSpitchWithRawResponse
222
+ with_streaming_response: AsyncSpitchWithStreamedResponse
223
+
224
+ # client options
225
+ api_key: str
226
+
227
+ def __init__(
228
+ self,
229
+ *,
230
+ api_key: str | None = None,
231
+ base_url: str | httpx.URL | None = None,
232
+ timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
233
+ max_retries: int = DEFAULT_MAX_RETRIES,
234
+ default_headers: Mapping[str, str] | None = None,
235
+ default_query: Mapping[str, object] | None = None,
236
+ # Configure a custom httpx client.
237
+ # We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`.
238
+ # See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details.
239
+ http_client: httpx.AsyncClient | None = None,
240
+ # Enable or disable schema validation for data returned by the API.
241
+ # When enabled an error APIResponseValidationError is raised
242
+ # if the API responds with invalid data for the expected schema.
243
+ #
244
+ # This parameter may be removed or changed in the future.
245
+ # If you rely on this feature, please open a GitHub issue
246
+ # outlining your use-case to help us decide if it should be
247
+ # part of our public interface in the future.
248
+ _strict_response_validation: bool = False,
249
+ ) -> None:
250
+ """Construct a new async spitch client instance.
251
+
252
+ This automatically infers the `api_key` argument from the `SPITCH_API_KEY` environment variable if it is not provided.
253
+ """
254
+ if api_key is None:
255
+ api_key = os.environ.get("SPITCH_API_KEY")
256
+ if api_key is None:
257
+ raise SpitchError(
258
+ "The api_key client option must be set either by passing api_key to the client or by setting the SPITCH_API_KEY environment variable"
259
+ )
260
+ self.api_key = api_key
261
+
262
+ if base_url is None:
263
+ base_url = os.environ.get("SPITCH_BASE_URL")
264
+ if base_url is None:
265
+ base_url = f"https://api.spi-tch.com"
266
+
267
+ super().__init__(
268
+ version=__version__,
269
+ base_url=base_url,
270
+ max_retries=max_retries,
271
+ timeout=timeout,
272
+ http_client=http_client,
273
+ custom_headers=default_headers,
274
+ custom_query=default_query,
275
+ _strict_response_validation=_strict_response_validation,
276
+ )
277
+
278
+ self.speech = resources.AsyncSpeechResource(self)
279
+ self.text = resources.AsyncTextResource(self)
280
+ self.with_raw_response = AsyncSpitchWithRawResponse(self)
281
+ self.with_streaming_response = AsyncSpitchWithStreamedResponse(self)
282
+
283
+ @property
284
+ @override
285
+ def qs(self) -> Querystring:
286
+ return Querystring(array_format="comma")
287
+
288
+ @property
289
+ @override
290
+ def auth_headers(self) -> dict[str, str]:
291
+ api_key = self.api_key
292
+ return {"Authorization": f"Bearer {api_key}"}
293
+
294
+ @property
295
+ @override
296
+ def default_headers(self) -> dict[str, str | Omit]:
297
+ return {
298
+ **super().default_headers,
299
+ "X-Stainless-Async": f"async:{get_async_library()}",
300
+ **self._custom_headers,
301
+ }
302
+
303
+ def copy(
304
+ self,
305
+ *,
306
+ api_key: str | None = None,
307
+ base_url: str | httpx.URL | None = None,
308
+ timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
309
+ http_client: httpx.AsyncClient | None = None,
310
+ max_retries: int | NotGiven = NOT_GIVEN,
311
+ default_headers: Mapping[str, str] | None = None,
312
+ set_default_headers: Mapping[str, str] | None = None,
313
+ default_query: Mapping[str, object] | None = None,
314
+ set_default_query: Mapping[str, object] | None = None,
315
+ _extra_kwargs: Mapping[str, Any] = {},
316
+ ) -> Self:
317
+ """
318
+ Create a new client instance re-using the same options given to the current client with optional overriding.
319
+ """
320
+ if default_headers is not None and set_default_headers is not None:
321
+ raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive")
322
+
323
+ if default_query is not None and set_default_query is not None:
324
+ raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive")
325
+
326
+ headers = self._custom_headers
327
+ if default_headers is not None:
328
+ headers = {**headers, **default_headers}
329
+ elif set_default_headers is not None:
330
+ headers = set_default_headers
331
+
332
+ params = self._custom_query
333
+ if default_query is not None:
334
+ params = {**params, **default_query}
335
+ elif set_default_query is not None:
336
+ params = set_default_query
337
+
338
+ http_client = http_client or self._client
339
+ return self.__class__(
340
+ api_key=api_key or self.api_key,
341
+ base_url=base_url or self.base_url,
342
+ timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
343
+ http_client=http_client,
344
+ max_retries=max_retries if is_given(max_retries) else self.max_retries,
345
+ default_headers=headers,
346
+ default_query=params,
347
+ **_extra_kwargs,
348
+ )
349
+
350
+ # Alias for `copy` for nicer inline usage, e.g.
351
+ # client.with_options(timeout=10).foo.create(...)
352
+ with_options = copy
353
+
354
+ @override
355
+ def _make_status_error(
356
+ self,
357
+ err_msg: str,
358
+ *,
359
+ body: object,
360
+ response: httpx.Response,
361
+ ) -> APIStatusError:
362
+ if response.status_code == 400:
363
+ return _exceptions.BadRequestError(err_msg, response=response, body=body)
364
+
365
+ if response.status_code == 401:
366
+ return _exceptions.AuthenticationError(err_msg, response=response, body=body)
367
+
368
+ if response.status_code == 403:
369
+ return _exceptions.PermissionDeniedError(err_msg, response=response, body=body)
370
+
371
+ if response.status_code == 404:
372
+ return _exceptions.NotFoundError(err_msg, response=response, body=body)
373
+
374
+ if response.status_code == 409:
375
+ return _exceptions.ConflictError(err_msg, response=response, body=body)
376
+
377
+ if response.status_code == 422:
378
+ return _exceptions.UnprocessableEntityError(err_msg, response=response, body=body)
379
+
380
+ if response.status_code == 429:
381
+ return _exceptions.RateLimitError(err_msg, response=response, body=body)
382
+
383
+ if response.status_code >= 500:
384
+ return _exceptions.InternalServerError(err_msg, response=response, body=body)
385
+ return APIStatusError(err_msg, response=response, body=body)
386
+
387
+
388
+ class SpitchWithRawResponse:
389
+ def __init__(self, client: Spitch) -> None:
390
+ self.speech = resources.SpeechResourceWithRawResponse(client.speech)
391
+ self.text = resources.TextResourceWithRawResponse(client.text)
392
+
393
+
394
+ class AsyncSpitchWithRawResponse:
395
+ def __init__(self, client: AsyncSpitch) -> None:
396
+ self.speech = resources.AsyncSpeechResourceWithRawResponse(client.speech)
397
+ self.text = resources.AsyncTextResourceWithRawResponse(client.text)
398
+
399
+
400
+ class SpitchWithStreamedResponse:
401
+ def __init__(self, client: Spitch) -> None:
402
+ self.speech = resources.SpeechResourceWithStreamingResponse(client.speech)
403
+ self.text = resources.TextResourceWithStreamingResponse(client.text)
404
+
405
+
406
+ class AsyncSpitchWithStreamedResponse:
407
+ def __init__(self, client: AsyncSpitch) -> None:
408
+ self.speech = resources.AsyncSpeechResourceWithStreamingResponse(client.speech)
409
+ self.text = resources.AsyncTextResourceWithStreamingResponse(client.text)
410
+
411
+
412
+ Client = Spitch
413
+
414
+ AsyncClient = AsyncSpitch
spitch/_compat.py ADDED
@@ -0,0 +1,219 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload
4
+ from datetime import date, datetime
5
+ from typing_extensions import Self
6
+
7
+ import pydantic
8
+ from pydantic.fields import FieldInfo
9
+
10
+ from ._types import IncEx, StrBytesIntFloat
11
+
12
+ _T = TypeVar("_T")
13
+ _ModelT = TypeVar("_ModelT", bound=pydantic.BaseModel)
14
+
15
+ # --------------- Pydantic v2 compatibility ---------------
16
+
17
+ # Pyright incorrectly reports some of our functions as overriding a method when they don't
18
+ # pyright: reportIncompatibleMethodOverride=false
19
+
20
+ PYDANTIC_V2 = pydantic.VERSION.startswith("2.")
21
+
22
+ # v1 re-exports
23
+ if TYPE_CHECKING:
24
+
25
+ def parse_date(value: date | StrBytesIntFloat) -> date: # noqa: ARG001
26
+ ...
27
+
28
+ def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: # noqa: ARG001
29
+ ...
30
+
31
+ def get_args(t: type[Any]) -> tuple[Any, ...]: # noqa: ARG001
32
+ ...
33
+
34
+ def is_union(tp: type[Any] | None) -> bool: # noqa: ARG001
35
+ ...
36
+
37
+ def get_origin(t: type[Any]) -> type[Any] | None: # noqa: ARG001
38
+ ...
39
+
40
+ def is_literal_type(type_: type[Any]) -> bool: # noqa: ARG001
41
+ ...
42
+
43
+ def is_typeddict(type_: type[Any]) -> bool: # noqa: ARG001
44
+ ...
45
+
46
+ else:
47
+ if PYDANTIC_V2:
48
+ from pydantic.v1.typing import (
49
+ get_args as get_args,
50
+ is_union as is_union,
51
+ get_origin as get_origin,
52
+ is_typeddict as is_typeddict,
53
+ is_literal_type as is_literal_type,
54
+ )
55
+ from pydantic.v1.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
56
+ else:
57
+ from pydantic.typing import (
58
+ get_args as get_args,
59
+ is_union as is_union,
60
+ get_origin as get_origin,
61
+ is_typeddict as is_typeddict,
62
+ is_literal_type as is_literal_type,
63
+ )
64
+ from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
65
+
66
+
67
+ # refactored config
68
+ if TYPE_CHECKING:
69
+ from pydantic import ConfigDict as ConfigDict
70
+ else:
71
+ if PYDANTIC_V2:
72
+ from pydantic import ConfigDict
73
+ else:
74
+ # TODO: provide an error message here?
75
+ ConfigDict = None
76
+
77
+
78
+ # renamed methods / properties
79
+ def parse_obj(model: type[_ModelT], value: object) -> _ModelT:
80
+ if PYDANTIC_V2:
81
+ return model.model_validate(value)
82
+ else:
83
+ return cast(_ModelT, model.parse_obj(value)) # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
84
+
85
+
86
+ def field_is_required(field: FieldInfo) -> bool:
87
+ if PYDANTIC_V2:
88
+ return field.is_required()
89
+ return field.required # type: ignore
90
+
91
+
92
+ def field_get_default(field: FieldInfo) -> Any:
93
+ value = field.get_default()
94
+ if PYDANTIC_V2:
95
+ from pydantic_core import PydanticUndefined
96
+
97
+ if value == PydanticUndefined:
98
+ return None
99
+ return value
100
+ return value
101
+
102
+
103
+ def field_outer_type(field: FieldInfo) -> Any:
104
+ if PYDANTIC_V2:
105
+ return field.annotation
106
+ return field.outer_type_ # type: ignore
107
+
108
+
109
+ def get_model_config(model: type[pydantic.BaseModel]) -> Any:
110
+ if PYDANTIC_V2:
111
+ return model.model_config
112
+ return model.__config__ # type: ignore
113
+
114
+
115
+ def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]:
116
+ if PYDANTIC_V2:
117
+ return model.model_fields
118
+ return model.__fields__ # type: ignore
119
+
120
+
121
+ def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT:
122
+ if PYDANTIC_V2:
123
+ return model.model_copy(deep=deep)
124
+ return model.copy(deep=deep) # type: ignore
125
+
126
+
127
+ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str:
128
+ if PYDANTIC_V2:
129
+ return model.model_dump_json(indent=indent)
130
+ return model.json(indent=indent) # type: ignore
131
+
132
+
133
+ def model_dump(
134
+ model: pydantic.BaseModel,
135
+ *,
136
+ exclude: IncEx = None,
137
+ exclude_unset: bool = False,
138
+ exclude_defaults: bool = False,
139
+ warnings: bool = True,
140
+ ) -> dict[str, Any]:
141
+ if PYDANTIC_V2:
142
+ return model.model_dump(
143
+ exclude=exclude,
144
+ exclude_unset=exclude_unset,
145
+ exclude_defaults=exclude_defaults,
146
+ warnings=warnings,
147
+ )
148
+ return cast(
149
+ "dict[str, Any]",
150
+ model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
151
+ exclude=exclude,
152
+ exclude_unset=exclude_unset,
153
+ exclude_defaults=exclude_defaults,
154
+ ),
155
+ )
156
+
157
+
158
+ def model_parse(model: type[_ModelT], data: Any) -> _ModelT:
159
+ if PYDANTIC_V2:
160
+ return model.model_validate(data)
161
+ return model.parse_obj(data) # pyright: ignore[reportDeprecated]
162
+
163
+
164
+ # generic models
165
+ if TYPE_CHECKING:
166
+
167
+ class GenericModel(pydantic.BaseModel): ...
168
+
169
+ else:
170
+ if PYDANTIC_V2:
171
+ # there no longer needs to be a distinction in v2 but
172
+ # we still have to create our own subclass to avoid
173
+ # inconsistent MRO ordering errors
174
+ class GenericModel(pydantic.BaseModel): ...
175
+
176
+ else:
177
+ import pydantic.generics
178
+
179
+ class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ...
180
+
181
+
182
+ # cached properties
183
+ if TYPE_CHECKING:
184
+ cached_property = property
185
+
186
+ # we define a separate type (copied from typeshed)
187
+ # that represents that `cached_property` is `set`able
188
+ # at runtime, which differs from `@property`.
189
+ #
190
+ # this is a separate type as editors likely special case
191
+ # `@property` and we don't want to cause issues just to have
192
+ # more helpful internal types.
193
+
194
+ class typed_cached_property(Generic[_T]):
195
+ func: Callable[[Any], _T]
196
+ attrname: str | None
197
+
198
+ def __init__(self, func: Callable[[Any], _T]) -> None: ...
199
+
200
+ @overload
201
+ def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: ...
202
+
203
+ @overload
204
+ def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ...
205
+
206
+ def __get__(self, instance: object, owner: type[Any] | None = None) -> _T | Self:
207
+ raise NotImplementedError()
208
+
209
+ def __set_name__(self, owner: type[Any], name: str) -> None: ...
210
+
211
+ # __set__ is not defined at runtime, but @cached_property is designed to be settable
212
+ def __set__(self, instance: object, value: _T) -> None: ...
213
+ else:
214
+ try:
215
+ from functools import cached_property as cached_property
216
+ except ImportError:
217
+ from cached_property import cached_property as cached_property
218
+
219
+ typed_cached_property = cached_property
spitch/_constants.py ADDED
@@ -0,0 +1,14 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import httpx
4
+
5
+ RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response"
6
+ OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to"
7
+
8
+ # default timeout is 1 minute
9
+ DEFAULT_TIMEOUT = httpx.Timeout(timeout=60.0, connect=5.0)
10
+ DEFAULT_MAX_RETRIES = 2
11
+ DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20)
12
+
13
+ INITIAL_RETRY_DELAY = 0.5
14
+ MAX_RETRY_DELAY = 8.0