videogen 0.0.19__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.
Files changed (77) hide show
  1. videogen/__init__.py +176 -0
  2. videogen/_default_clients.py +30 -0
  3. videogen/client.py +262 -0
  4. videogen/core/__init__.py +127 -0
  5. videogen/core/api_error.py +23 -0
  6. videogen/core/client_wrapper.py +106 -0
  7. videogen/core/datetime_utils.py +70 -0
  8. videogen/core/file.py +67 -0
  9. videogen/core/force_multipart.py +18 -0
  10. videogen/core/http_client.py +840 -0
  11. videogen/core/http_response.py +59 -0
  12. videogen/core/http_sse/__init__.py +42 -0
  13. videogen/core/http_sse/_api.py +112 -0
  14. videogen/core/http_sse/_decoders.py +61 -0
  15. videogen/core/http_sse/_exceptions.py +7 -0
  16. videogen/core/http_sse/_models.py +17 -0
  17. videogen/core/jsonable_encoder.py +120 -0
  18. videogen/core/logging.py +107 -0
  19. videogen/core/parse_error.py +36 -0
  20. videogen/core/pydantic_utilities.py +634 -0
  21. videogen/core/query_encoder.py +58 -0
  22. videogen/core/remove_none_from_dict.py +11 -0
  23. videogen/core/request_options.py +35 -0
  24. videogen/core/serialization.py +276 -0
  25. videogen/environment.py +7 -0
  26. videogen/files/__init__.py +34 -0
  27. videogen/files/client.py +589 -0
  28. videogen/files/raw_client.py +697 -0
  29. videogen/files/types/__init__.py +34 -0
  30. videogen/files/types/create_file_upload_request_type.py +5 -0
  31. videogen/py.typed +0 -0
  32. videogen/resources/__init__.py +4 -0
  33. videogen/resources/client.py +185 -0
  34. videogen/resources/raw_client.py +202 -0
  35. videogen/tools/__init__.py +4 -0
  36. videogen/tools/client.py +1720 -0
  37. videogen/tools/raw_client.py +1999 -0
  38. videogen/types/__init__.py +131 -0
  39. videogen/types/api_error.py +20 -0
  40. videogen/types/aspect_ratio.py +24 -0
  41. videogen/types/avatar_presenter.py +53 -0
  42. videogen/types/avatar_presenter_displayable_gender.py +5 -0
  43. videogen/types/avatar_presenter_list_response.py +24 -0
  44. videogen/types/executed_tool.py +40 -0
  45. videogen/types/executed_tool_status.py +5 -0
  46. videogen/types/file_source.py +57 -0
  47. videogen/types/file_source_status.py +5 -0
  48. videogen/types/file_upload_response.py +32 -0
  49. videogen/types/file_upload_webhook_event_name.py +15 -0
  50. videogen/types/file_upload_webhook_payload.py +45 -0
  51. videogen/types/get_files_response.py +20 -0
  52. videogen/types/image_asset_request.py +41 -0
  53. videogen/types/pronunciation_replacement.py +20 -0
  54. videogen/types/search_files_response.py +20 -0
  55. videogen/types/search_files_result.py +25 -0
  56. videogen/types/start_tool_execution_response.py +29 -0
  57. videogen/types/storage_file.py +131 -0
  58. videogen/types/storage_file_scope.py +5 -0
  59. videogen/types/storage_file_type.py +5 -0
  60. videogen/types/tool_execution_webhook_event_name.py +7 -0
  61. videogen/types/tool_execution_webhook_payload.py +55 -0
  62. videogen/types/tool_success_result.py +40 -0
  63. videogen/types/tool_success_result_type.py +5 -0
  64. videogen/types/tts_voice.py +82 -0
  65. videogen/types/tts_voice_display_gender.py +5 -0
  66. videogen/types/tts_voice_list_response.py +24 -0
  67. videogen/types/video_asset_request.py +41 -0
  68. videogen/types/webhook_endpoint.py +47 -0
  69. videogen/types/webhook_endpoint_list_response.py +20 -0
  70. videogen/types/webhook_event_name.py +18 -0
  71. videogen/version.py +3 -0
  72. videogen/webhooks/__init__.py +4 -0
  73. videogen/webhooks/client.py +277 -0
  74. videogen/webhooks/raw_client.py +299 -0
  75. videogen-0.0.19.dist-info/METADATA +218 -0
  76. videogen-0.0.19.dist-info/RECORD +77 -0
  77. videogen-0.0.19.dist-info/WHEEL +4 -0
videogen/__init__.py ADDED
@@ -0,0 +1,176 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ import typing
6
+ from importlib import import_module
7
+
8
+ if typing.TYPE_CHECKING:
9
+ from .types import (
10
+ ApiError,
11
+ AspectRatio,
12
+ AvatarPresenter,
13
+ AvatarPresenterDisplayableGender,
14
+ AvatarPresenterListResponse,
15
+ ExecutedTool,
16
+ ExecutedToolStatus,
17
+ FileSource,
18
+ FileSourceStatus,
19
+ FileUploadResponse,
20
+ FileUploadWebhookEventName,
21
+ FileUploadWebhookPayload,
22
+ GetFilesResponse,
23
+ ImageAssetRequest,
24
+ PronunciationReplacement,
25
+ SearchFilesResponse,
26
+ SearchFilesResult,
27
+ StartToolExecutionResponse,
28
+ StorageFile,
29
+ StorageFileScope,
30
+ StorageFileType,
31
+ ToolExecutionWebhookEventName,
32
+ ToolExecutionWebhookPayload,
33
+ ToolSuccessResult,
34
+ ToolSuccessResultType,
35
+ TtsVoice,
36
+ TtsVoiceDisplayGender,
37
+ TtsVoiceListResponse,
38
+ VideoAssetRequest,
39
+ WebhookEndpoint,
40
+ WebhookEndpointListResponse,
41
+ WebhookEventName,
42
+ )
43
+ from . import files, resources, tools, webhooks
44
+ from ._default_clients import DefaultAioHttpClient, DefaultAsyncHttpxClient
45
+ from .client import AsyncVideoGenApi, VideoGenApi
46
+ from .download_file import download_file
47
+ from .environment import VideoGenApiEnvironment
48
+ from .files import CreateFileUploadRequestType
49
+ from .get_hydrated_file import get_hydrated_file
50
+ from .poll_executed_tool import poll_executed_tool
51
+ from .upload_file import upload_file
52
+ from .verify_webhook_signature import verify_webhook_signature
53
+ from .version import __version__
54
+ _dynamic_imports: typing.Dict[str, str] = {
55
+ "ApiError": ".types",
56
+ "AspectRatio": ".types",
57
+ "AsyncVideoGenApi": ".client",
58
+ "AvatarPresenter": ".types",
59
+ "AvatarPresenterDisplayableGender": ".types",
60
+ "AvatarPresenterListResponse": ".types",
61
+ "CreateFileUploadRequestType": ".files",
62
+ "DefaultAioHttpClient": "._default_clients",
63
+ "DefaultAsyncHttpxClient": "._default_clients",
64
+ "ExecutedTool": ".types",
65
+ "ExecutedToolStatus": ".types",
66
+ "FileSource": ".types",
67
+ "FileSourceStatus": ".types",
68
+ "FileUploadResponse": ".types",
69
+ "FileUploadWebhookEventName": ".types",
70
+ "FileUploadWebhookPayload": ".types",
71
+ "GetFilesResponse": ".types",
72
+ "ImageAssetRequest": ".types",
73
+ "PronunciationReplacement": ".types",
74
+ "SearchFilesResponse": ".types",
75
+ "SearchFilesResult": ".types",
76
+ "StartToolExecutionResponse": ".types",
77
+ "StorageFile": ".types",
78
+ "StorageFileScope": ".types",
79
+ "StorageFileType": ".types",
80
+ "ToolExecutionWebhookEventName": ".types",
81
+ "ToolExecutionWebhookPayload": ".types",
82
+ "ToolSuccessResult": ".types",
83
+ "ToolSuccessResultType": ".types",
84
+ "TtsVoice": ".types",
85
+ "TtsVoiceDisplayGender": ".types",
86
+ "TtsVoiceListResponse": ".types",
87
+ "VideoAssetRequest": ".types",
88
+ "VideoGenApi": ".client",
89
+ "VideoGenApiEnvironment": ".environment",
90
+ "WebhookEndpoint": ".types",
91
+ "WebhookEndpointListResponse": ".types",
92
+ "WebhookEventName": ".types",
93
+ "__version__": ".version",
94
+ "download_file": ".download_file",
95
+ "files": ".files",
96
+ "get_hydrated_file": ".get_hydrated_file",
97
+ "poll_executed_tool": ".poll_executed_tool",
98
+ "resources": ".resources",
99
+ "tools": ".tools",
100
+ "upload_file": ".upload_file",
101
+ "verify_webhook_signature": ".verify_webhook_signature",
102
+ "webhooks": ".webhooks",
103
+ }
104
+
105
+
106
+ def __getattr__(attr_name: str) -> typing.Any:
107
+ module_name = _dynamic_imports.get(attr_name)
108
+ if module_name is None:
109
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
110
+ try:
111
+ module = import_module(module_name, __package__)
112
+ if module_name == f".{attr_name}":
113
+ return module
114
+ else:
115
+ return getattr(module, attr_name)
116
+ except ImportError as e:
117
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
118
+ except AttributeError as e:
119
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
120
+
121
+
122
+ def __dir__():
123
+ lazy_attrs = list(_dynamic_imports.keys())
124
+ return sorted(lazy_attrs)
125
+
126
+
127
+ __all__ = [
128
+ "ApiError",
129
+ "AspectRatio",
130
+ "AsyncVideoGenApi",
131
+ "AvatarPresenter",
132
+ "AvatarPresenterDisplayableGender",
133
+ "AvatarPresenterListResponse",
134
+ "CreateFileUploadRequestType",
135
+ "DefaultAioHttpClient",
136
+ "DefaultAsyncHttpxClient",
137
+ "ExecutedTool",
138
+ "ExecutedToolStatus",
139
+ "FileSource",
140
+ "FileSourceStatus",
141
+ "FileUploadResponse",
142
+ "FileUploadWebhookEventName",
143
+ "FileUploadWebhookPayload",
144
+ "GetFilesResponse",
145
+ "ImageAssetRequest",
146
+ "PronunciationReplacement",
147
+ "SearchFilesResponse",
148
+ "SearchFilesResult",
149
+ "StartToolExecutionResponse",
150
+ "StorageFile",
151
+ "StorageFileScope",
152
+ "StorageFileType",
153
+ "ToolExecutionWebhookEventName",
154
+ "ToolExecutionWebhookPayload",
155
+ "ToolSuccessResult",
156
+ "ToolSuccessResultType",
157
+ "TtsVoice",
158
+ "TtsVoiceDisplayGender",
159
+ "TtsVoiceListResponse",
160
+ "VideoAssetRequest",
161
+ "VideoGenApi",
162
+ "VideoGenApiEnvironment",
163
+ "WebhookEndpoint",
164
+ "WebhookEndpointListResponse",
165
+ "WebhookEventName",
166
+ "__version__",
167
+ "download_file",
168
+ "files",
169
+ "get_hydrated_file",
170
+ "poll_executed_tool",
171
+ "resources",
172
+ "tools",
173
+ "upload_file",
174
+ "verify_webhook_signature",
175
+ "webhooks",
176
+ ]
@@ -0,0 +1,30 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import httpx
6
+
7
+ SDK_DEFAULT_TIMEOUT = 60
8
+
9
+ try:
10
+ import httpx_aiohttp # type: ignore[import-not-found]
11
+ except ImportError:
12
+
13
+ class DefaultAioHttpClient(httpx.AsyncClient): # type: ignore
14
+ def __init__(self, **kwargs: typing.Any) -> None:
15
+ raise RuntimeError("To use the aiohttp client, install the aiohttp extra: pip install videogen[aiohttp]")
16
+
17
+ else:
18
+
19
+ class DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
20
+ def __init__(self, **kwargs: typing.Any) -> None:
21
+ kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
22
+ kwargs.setdefault("follow_redirects", True)
23
+ super().__init__(**kwargs)
24
+
25
+
26
+ class DefaultAsyncHttpxClient(httpx.AsyncClient):
27
+ def __init__(self, **kwargs: typing.Any) -> None:
28
+ kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
29
+ kwargs.setdefault("follow_redirects", True)
30
+ super().__init__(**kwargs)
videogen/client.py ADDED
@@ -0,0 +1,262 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from __future__ import annotations
4
+
5
+ import typing
6
+
7
+ import httpx
8
+ from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
+ from .core.logging import LogConfig, Logger
10
+ from .environment import VideoGenApiEnvironment
11
+
12
+ if typing.TYPE_CHECKING:
13
+ from .files.client import AsyncFilesClient, FilesClient
14
+ from .resources.client import AsyncResourcesClient, ResourcesClient
15
+ from .tools.client import AsyncToolsClient, ToolsClient
16
+ from .webhooks.client import AsyncWebhooksClient, WebhooksClient
17
+
18
+
19
+ class VideoGenApi:
20
+ """
21
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
22
+
23
+ Parameters
24
+ ----------
25
+ base_url : typing.Optional[str]
26
+ The base url to use for requests from the client.
27
+
28
+ environment : VideoGenApiEnvironment
29
+ The environment to use for requests from the client. from .environment import VideoGenApiEnvironment
30
+
31
+
32
+
33
+ Defaults to VideoGenApiEnvironment.PRODUCTION
34
+
35
+
36
+
37
+ token : typing.Union[str, typing.Callable[[], str]]
38
+ headers : typing.Optional[typing.Dict[str, str]]
39
+ Additional headers to send with every request.
40
+
41
+ timeout : typing.Optional[float]
42
+ The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
43
+
44
+ follow_redirects : typing.Optional[bool]
45
+ Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
46
+
47
+ httpx_client : typing.Optional[httpx.Client]
48
+ The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
49
+
50
+ logging : typing.Optional[typing.Union[LogConfig, Logger]]
51
+ Configure logging for the SDK. Accepts a LogConfig dict with 'level' (debug/info/warn/error), 'logger' (custom logger implementation), and 'silent' (boolean, defaults to True) fields. You can also pass a pre-configured Logger instance.
52
+
53
+ Examples
54
+ --------
55
+ from videogen import VideoGenApi
56
+
57
+ client = VideoGenApi(
58
+ token="YOUR_TOKEN",
59
+ )
60
+ """
61
+
62
+ def __init__(
63
+ self,
64
+ *,
65
+ base_url: typing.Optional[str] = None,
66
+ environment: VideoGenApiEnvironment = VideoGenApiEnvironment.PRODUCTION,
67
+ token: typing.Union[str, typing.Callable[[], str]],
68
+ headers: typing.Optional[typing.Dict[str, str]] = None,
69
+ timeout: typing.Optional[float] = None,
70
+ follow_redirects: typing.Optional[bool] = True,
71
+ httpx_client: typing.Optional[httpx.Client] = None,
72
+ logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
73
+ ):
74
+ _defaulted_timeout = (
75
+ timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
76
+ )
77
+ self._client_wrapper = SyncClientWrapper(
78
+ base_url=_get_base_url(base_url=base_url, environment=environment),
79
+ token=token,
80
+ headers=headers,
81
+ httpx_client=httpx_client
82
+ if httpx_client is not None
83
+ else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
84
+ if follow_redirects is not None
85
+ else httpx.Client(timeout=_defaulted_timeout),
86
+ timeout=_defaulted_timeout,
87
+ logging=logging,
88
+ )
89
+ self._tools: typing.Optional[ToolsClient] = None
90
+ self._files: typing.Optional[FilesClient] = None
91
+ self._resources: typing.Optional[ResourcesClient] = None
92
+ self._webhooks: typing.Optional[WebhooksClient] = None
93
+
94
+ @property
95
+ def tools(self):
96
+ if self._tools is None:
97
+ from .tools.client import ToolsClient # noqa: E402
98
+
99
+ self._tools = ToolsClient(client_wrapper=self._client_wrapper)
100
+ return self._tools
101
+
102
+ @property
103
+ def files(self):
104
+ if self._files is None:
105
+ from .files.client import FilesClient # noqa: E402
106
+
107
+ self._files = FilesClient(client_wrapper=self._client_wrapper)
108
+ return self._files
109
+
110
+ @property
111
+ def resources(self):
112
+ if self._resources is None:
113
+ from .resources.client import ResourcesClient # noqa: E402
114
+
115
+ self._resources = ResourcesClient(client_wrapper=self._client_wrapper)
116
+ return self._resources
117
+
118
+ @property
119
+ def webhooks(self):
120
+ if self._webhooks is None:
121
+ from .webhooks.client import WebhooksClient # noqa: E402
122
+
123
+ self._webhooks = WebhooksClient(client_wrapper=self._client_wrapper)
124
+ return self._webhooks
125
+
126
+
127
+ def _make_default_async_client(
128
+ timeout: typing.Optional[float],
129
+ follow_redirects: typing.Optional[bool],
130
+ ) -> httpx.AsyncClient:
131
+ try:
132
+ import httpx_aiohttp # type: ignore[import-not-found]
133
+ except ImportError:
134
+ pass
135
+ else:
136
+ if follow_redirects is not None:
137
+ return httpx_aiohttp.HttpxAiohttpClient(timeout=timeout, follow_redirects=follow_redirects)
138
+ return httpx_aiohttp.HttpxAiohttpClient(timeout=timeout)
139
+
140
+ if follow_redirects is not None:
141
+ return httpx.AsyncClient(timeout=timeout, follow_redirects=follow_redirects)
142
+ return httpx.AsyncClient(timeout=timeout)
143
+
144
+
145
+ class AsyncVideoGenApi:
146
+ """
147
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
148
+
149
+ Parameters
150
+ ----------
151
+ base_url : typing.Optional[str]
152
+ The base url to use for requests from the client.
153
+
154
+ environment : VideoGenApiEnvironment
155
+ The environment to use for requests from the client. from .environment import VideoGenApiEnvironment
156
+
157
+
158
+
159
+ Defaults to VideoGenApiEnvironment.PRODUCTION
160
+
161
+
162
+
163
+ token : typing.Union[str, typing.Callable[[], str]]
164
+ headers : typing.Optional[typing.Dict[str, str]]
165
+ Additional headers to send with every request.
166
+
167
+ async_token : typing.Optional[typing.Callable[[], typing.Awaitable[str]]]
168
+ An async callable that returns a bearer token. Use this when token acquisition involves async I/O (e.g., refreshing tokens via an async HTTP client). When provided, this is used instead of the synchronous token for async requests.
169
+
170
+ timeout : typing.Optional[float]
171
+ The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
172
+
173
+ follow_redirects : typing.Optional[bool]
174
+ Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
175
+
176
+ httpx_client : typing.Optional[httpx.AsyncClient]
177
+ The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
178
+
179
+ logging : typing.Optional[typing.Union[LogConfig, Logger]]
180
+ Configure logging for the SDK. Accepts a LogConfig dict with 'level' (debug/info/warn/error), 'logger' (custom logger implementation), and 'silent' (boolean, defaults to True) fields. You can also pass a pre-configured Logger instance.
181
+
182
+ Examples
183
+ --------
184
+ from videogen import AsyncVideoGenApi
185
+
186
+ client = AsyncVideoGenApi(
187
+ token="YOUR_TOKEN",
188
+ )
189
+ """
190
+
191
+ def __init__(
192
+ self,
193
+ *,
194
+ base_url: typing.Optional[str] = None,
195
+ environment: VideoGenApiEnvironment = VideoGenApiEnvironment.PRODUCTION,
196
+ token: typing.Union[str, typing.Callable[[], str]],
197
+ headers: typing.Optional[typing.Dict[str, str]] = None,
198
+ async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None,
199
+ timeout: typing.Optional[float] = None,
200
+ follow_redirects: typing.Optional[bool] = True,
201
+ httpx_client: typing.Optional[httpx.AsyncClient] = None,
202
+ logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
203
+ ):
204
+ _defaulted_timeout = (
205
+ timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
206
+ )
207
+ self._client_wrapper = AsyncClientWrapper(
208
+ base_url=_get_base_url(base_url=base_url, environment=environment),
209
+ token=token,
210
+ headers=headers,
211
+ async_token=async_token,
212
+ httpx_client=httpx_client
213
+ if httpx_client is not None
214
+ else _make_default_async_client(timeout=_defaulted_timeout, follow_redirects=follow_redirects),
215
+ timeout=_defaulted_timeout,
216
+ logging=logging,
217
+ )
218
+ self._tools: typing.Optional[AsyncToolsClient] = None
219
+ self._files: typing.Optional[AsyncFilesClient] = None
220
+ self._resources: typing.Optional[AsyncResourcesClient] = None
221
+ self._webhooks: typing.Optional[AsyncWebhooksClient] = None
222
+
223
+ @property
224
+ def tools(self):
225
+ if self._tools is None:
226
+ from .tools.client import AsyncToolsClient # noqa: E402
227
+
228
+ self._tools = AsyncToolsClient(client_wrapper=self._client_wrapper)
229
+ return self._tools
230
+
231
+ @property
232
+ def files(self):
233
+ if self._files is None:
234
+ from .files.client import AsyncFilesClient # noqa: E402
235
+
236
+ self._files = AsyncFilesClient(client_wrapper=self._client_wrapper)
237
+ return self._files
238
+
239
+ @property
240
+ def resources(self):
241
+ if self._resources is None:
242
+ from .resources.client import AsyncResourcesClient # noqa: E402
243
+
244
+ self._resources = AsyncResourcesClient(client_wrapper=self._client_wrapper)
245
+ return self._resources
246
+
247
+ @property
248
+ def webhooks(self):
249
+ if self._webhooks is None:
250
+ from .webhooks.client import AsyncWebhooksClient # noqa: E402
251
+
252
+ self._webhooks = AsyncWebhooksClient(client_wrapper=self._client_wrapper)
253
+ return self._webhooks
254
+
255
+
256
+ def _get_base_url(*, base_url: typing.Optional[str] = None, environment: VideoGenApiEnvironment) -> str:
257
+ if base_url is not None:
258
+ return base_url
259
+ elif environment is not None:
260
+ return environment.value
261
+ else:
262
+ raise Exception("Please pass in either base_url or environment to construct the client")
@@ -0,0 +1,127 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ import typing
6
+ from importlib import import_module
7
+
8
+ if typing.TYPE_CHECKING:
9
+ from .api_error import ApiError
10
+ from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
11
+ from .datetime_utils import Rfc2822DateTime, parse_rfc2822_datetime, serialize_datetime
12
+ from .file import File, convert_file_dict_to_httpx_tuples, with_content_type
13
+ from .http_client import AsyncHttpClient, HttpClient
14
+ from .http_response import AsyncHttpResponse, HttpResponse
15
+ from .jsonable_encoder import encode_path_param, jsonable_encoder
16
+ from .logging import ConsoleLogger, ILogger, LogConfig, LogLevel, Logger, create_logger
17
+ from .parse_error import ParsingError
18
+ from .pydantic_utilities import (
19
+ IS_PYDANTIC_V2,
20
+ UniversalBaseModel,
21
+ UniversalRootModel,
22
+ parse_obj_as,
23
+ universal_field_validator,
24
+ universal_root_validator,
25
+ update_forward_refs,
26
+ )
27
+ from .query_encoder import encode_query
28
+ from .remove_none_from_dict import remove_none_from_dict
29
+ from .request_options import RequestOptions
30
+ from .serialization import FieldMetadata, convert_and_respect_annotation_metadata
31
+ _dynamic_imports: typing.Dict[str, str] = {
32
+ "ApiError": ".api_error",
33
+ "AsyncClientWrapper": ".client_wrapper",
34
+ "AsyncHttpClient": ".http_client",
35
+ "AsyncHttpResponse": ".http_response",
36
+ "BaseClientWrapper": ".client_wrapper",
37
+ "ConsoleLogger": ".logging",
38
+ "FieldMetadata": ".serialization",
39
+ "File": ".file",
40
+ "HttpClient": ".http_client",
41
+ "HttpResponse": ".http_response",
42
+ "ILogger": ".logging",
43
+ "IS_PYDANTIC_V2": ".pydantic_utilities",
44
+ "LogConfig": ".logging",
45
+ "LogLevel": ".logging",
46
+ "Logger": ".logging",
47
+ "ParsingError": ".parse_error",
48
+ "RequestOptions": ".request_options",
49
+ "Rfc2822DateTime": ".datetime_utils",
50
+ "SyncClientWrapper": ".client_wrapper",
51
+ "UniversalBaseModel": ".pydantic_utilities",
52
+ "UniversalRootModel": ".pydantic_utilities",
53
+ "convert_and_respect_annotation_metadata": ".serialization",
54
+ "convert_file_dict_to_httpx_tuples": ".file",
55
+ "create_logger": ".logging",
56
+ "encode_path_param": ".jsonable_encoder",
57
+ "encode_query": ".query_encoder",
58
+ "jsonable_encoder": ".jsonable_encoder",
59
+ "parse_obj_as": ".pydantic_utilities",
60
+ "parse_rfc2822_datetime": ".datetime_utils",
61
+ "remove_none_from_dict": ".remove_none_from_dict",
62
+ "serialize_datetime": ".datetime_utils",
63
+ "universal_field_validator": ".pydantic_utilities",
64
+ "universal_root_validator": ".pydantic_utilities",
65
+ "update_forward_refs": ".pydantic_utilities",
66
+ "with_content_type": ".file",
67
+ }
68
+
69
+
70
+ def __getattr__(attr_name: str) -> typing.Any:
71
+ module_name = _dynamic_imports.get(attr_name)
72
+ if module_name is None:
73
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
74
+ try:
75
+ module = import_module(module_name, __package__)
76
+ if module_name == f".{attr_name}":
77
+ return module
78
+ else:
79
+ return getattr(module, attr_name)
80
+ except ImportError as e:
81
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
82
+ except AttributeError as e:
83
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
84
+
85
+
86
+ def __dir__():
87
+ lazy_attrs = list(_dynamic_imports.keys())
88
+ return sorted(lazy_attrs)
89
+
90
+
91
+ __all__ = [
92
+ "ApiError",
93
+ "AsyncClientWrapper",
94
+ "AsyncHttpClient",
95
+ "AsyncHttpResponse",
96
+ "BaseClientWrapper",
97
+ "ConsoleLogger",
98
+ "FieldMetadata",
99
+ "File",
100
+ "HttpClient",
101
+ "HttpResponse",
102
+ "ILogger",
103
+ "IS_PYDANTIC_V2",
104
+ "LogConfig",
105
+ "LogLevel",
106
+ "Logger",
107
+ "ParsingError",
108
+ "RequestOptions",
109
+ "Rfc2822DateTime",
110
+ "SyncClientWrapper",
111
+ "UniversalBaseModel",
112
+ "UniversalRootModel",
113
+ "convert_and_respect_annotation_metadata",
114
+ "convert_file_dict_to_httpx_tuples",
115
+ "create_logger",
116
+ "encode_path_param",
117
+ "encode_query",
118
+ "jsonable_encoder",
119
+ "parse_obj_as",
120
+ "parse_rfc2822_datetime",
121
+ "remove_none_from_dict",
122
+ "serialize_datetime",
123
+ "universal_field_validator",
124
+ "universal_root_validator",
125
+ "update_forward_refs",
126
+ "with_content_type",
127
+ ]
@@ -0,0 +1,23 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from typing import Any, Dict, Optional
4
+
5
+
6
+ class ApiError(Exception):
7
+ headers: Optional[Dict[str, str]]
8
+ status_code: Optional[int]
9
+ body: Any
10
+
11
+ def __init__(
12
+ self,
13
+ *,
14
+ headers: Optional[Dict[str, str]] = None,
15
+ status_code: Optional[int] = None,
16
+ body: Any = None,
17
+ ) -> None:
18
+ self.headers = headers
19
+ self.status_code = status_code
20
+ self.body = body
21
+
22
+ def __str__(self) -> str:
23
+ return f"headers: {self.headers}, status_code: {self.status_code}, body: {self.body}"