hydradb-sdk 0.0.1__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.
- hydra_db/__init__.py +302 -0
- hydra_db/_default_clients.py +30 -0
- hydra_db/client.py +439 -0
- hydra_db/core/__init__.py +127 -0
- hydra_db/core/api_error.py +23 -0
- hydra_db/core/client_wrapper.py +105 -0
- hydra_db/core/datetime_utils.py +70 -0
- hydra_db/core/file.py +67 -0
- hydra_db/core/force_multipart.py +18 -0
- hydra_db/core/http_client.py +839 -0
- hydra_db/core/http_response.py +59 -0
- hydra_db/core/http_sse/__init__.py +42 -0
- hydra_db/core/http_sse/_api.py +148 -0
- hydra_db/core/http_sse/_decoders.py +61 -0
- hydra_db/core/http_sse/_exceptions.py +7 -0
- hydra_db/core/http_sse/_models.py +17 -0
- hydra_db/core/jsonable_encoder.py +120 -0
- hydra_db/core/logging.py +107 -0
- hydra_db/core/parse_error.py +36 -0
- hydra_db/core/pydantic_utilities.py +634 -0
- hydra_db/core/query_encoder.py +58 -0
- hydra_db/core/remove_none_from_dict.py +11 -0
- hydra_db/core/request_options.py +35 -0
- hydra_db/core/serialization.py +276 -0
- hydra_db/data/__init__.py +4 -0
- hydra_db/data/client.py +137 -0
- hydra_db/data/raw_client.py +305 -0
- hydra_db/embeddings/__init__.py +4 -0
- hydra_db/embeddings/client.py +596 -0
- hydra_db/embeddings/raw_client.py +1217 -0
- hydra_db/environment.py +7 -0
- hydra_db/errors/__init__.py +59 -0
- hydra_db/errors/bad_request_error.py +10 -0
- hydra_db/errors/forbidden_error.py +10 -0
- hydra_db/errors/internal_server_error.py +10 -0
- hydra_db/errors/not_found_error.py +10 -0
- hydra_db/errors/service_unavailable_error.py +10 -0
- hydra_db/errors/too_many_requests_error.py +11 -0
- hydra_db/errors/unauthorized_error.py +10 -0
- hydra_db/errors/unprocessable_entity_error.py +10 -0
- hydra_db/fetch/__init__.py +34 -0
- hydra_db/fetch/client.py +448 -0
- hydra_db/fetch/raw_client.py +953 -0
- hydra_db/fetch/types/__init__.py +34 -0
- hydra_db/fetch/types/list_data_fetch_response.py +8 -0
- hydra_db/graph_health/__init__.py +4 -0
- hydra_db/graph_health/client.py +152 -0
- hydra_db/graph_health/raw_client.py +308 -0
- hydra_db/ingestion_pipeline/__init__.py +4 -0
- hydra_db/ingestion_pipeline/client.py +191 -0
- hydra_db/ingestion_pipeline/raw_client.py +215 -0
- hydra_db/key/__init__.py +4 -0
- hydra_db/key/client.py +143 -0
- hydra_db/key/raw_client.py +319 -0
- hydra_db/raw_client.py +102 -0
- hydra_db/recall/__init__.py +4 -0
- hydra_db/recall/client.py +765 -0
- hydra_db/recall/raw_client.py +1542 -0
- hydra_db/tenant/__init__.py +4 -0
- hydra_db/tenant/client.py +497 -0
- hydra_db/tenant/raw_client.py +1532 -0
- hydra_db/tests/conftest.py +21 -0
- hydra_db/tests/test_aiohttp_autodetect.py +113 -0
- hydra_db/types/__init__.py +239 -0
- hydra_db/types/actual_error_response.py +20 -0
- hydra_db/types/add_memory_response.py +39 -0
- hydra_db/types/api_key_create_response.py +48 -0
- hydra_db/types/attachment_model.py +53 -0
- hydra_db/types/batch_processing_status.py +23 -0
- hydra_db/types/bm25operator_type.py +5 -0
- hydra_db/types/collection_stats.py +27 -0
- hydra_db/types/content_filter.py +49 -0
- hydra_db/types/content_model.py +47 -0
- hydra_db/types/cortex_models_response_commons_actual_error_response.py +20 -0
- hydra_db/types/cortex_models_response_commons_error_response.py +21 -0
- hydra_db/types/custom_property_definition.py +74 -0
- hydra_db/types/delete_result.py +36 -0
- hydra_db/types/delete_user_memory_response.py +31 -0
- hydra_db/types/entity.py +42 -0
- hydra_db/types/error_response.py +21 -0
- hydra_db/types/fetch_mode.py +5 -0
- hydra_db/types/forceful_relations_payload.py +27 -0
- hydra_db/types/graph_context.py +30 -0
- hydra_db/types/http_validation_error.py +20 -0
- hydra_db/types/infra.py +21 -0
- hydra_db/types/infra_status_response.py +42 -0
- hydra_db/types/ingest_response.py +20 -0
- hydra_db/types/insert_result.py +41 -0
- hydra_db/types/list_content_kind.py +5 -0
- hydra_db/types/list_user_memories_response.py +43 -0
- hydra_db/types/memory_item.py +98 -0
- hydra_db/types/memory_result_item.py +47 -0
- hydra_db/types/milvus_data_type.py +21 -0
- hydra_db/types/pagination_meta.py +51 -0
- hydra_db/types/path_triplet.py +23 -0
- hydra_db/types/processing_status.py +48 -0
- hydra_db/types/processing_status_indexing_status.py +7 -0
- hydra_db/types/qn_a_search_response.py +49 -0
- hydra_db/types/raw_embedding_document.py +47 -0
- hydra_db/types/raw_embedding_search_result.py +47 -0
- hydra_db/types/raw_embedding_vector.py +31 -0
- hydra_db/types/recall_search_request.py +78 -0
- hydra_db/types/recall_search_request_alpha.py +5 -0
- hydra_db/types/relation_evidence.py +72 -0
- hydra_db/types/retrieval_result.py +36 -0
- hydra_db/types/retrieve_mode.py +5 -0
- hydra_db/types/scored_path_response.py +31 -0
- hydra_db/types/search_mode.py +5 -0
- hydra_db/types/source_delete_response.py +30 -0
- hydra_db/types/source_delete_result_item.py +36 -0
- hydra_db/types/source_fetch_response.py +66 -0
- hydra_db/types/source_graph_relations_response.py +33 -0
- hydra_db/types/source_info.py +57 -0
- hydra_db/types/source_list_response.py +5 -0
- hydra_db/types/source_model.py +99 -0
- hydra_db/types/source_status.py +5 -0
- hydra_db/types/source_upload_response.py +35 -0
- hydra_db/types/source_upload_result_item.py +38 -0
- hydra_db/types/sub_tenant_ids_response.py +31 -0
- hydra_db/types/super_node_item.py +26 -0
- hydra_db/types/super_node_response.py +28 -0
- hydra_db/types/supported_llm_providers.py +5 -0
- hydra_db/types/tenant_create_accepted_response.py +36 -0
- hydra_db/types/tenant_delete_response.py +25 -0
- hydra_db/types/tenant_ids_response.py +32 -0
- hydra_db/types/tenant_stats_response.py +38 -0
- hydra_db/types/triplet_with_evidence.py +35 -0
- hydra_db/types/user_assistant_pair.py +31 -0
- hydra_db/types/user_memory.py +31 -0
- hydra_db/types/validation_error.py +22 -0
- hydra_db/types/validation_error_loc_item.py +5 -0
- hydra_db/types/vector_store_chunk.py +77 -0
- hydra_db/upload/__init__.py +4 -0
- hydra_db/upload/client.py +514 -0
- hydra_db/upload/raw_client.py +1191 -0
- hydradb_sdk-0.0.1.dist-info/METADATA +607 -0
- hydradb_sdk-0.0.1.dist-info/RECORD +140 -0
- hydradb_sdk-0.0.1.dist-info/WHEEL +5 -0
- hydradb_sdk-0.0.1.dist-info/licenses/LICENSE +22 -0
- hydradb_sdk-0.0.1.dist-info/top_level.txt +1 -0
hydra_db/__init__.py
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
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
|
+
ActualErrorResponse,
|
|
11
|
+
AddMemoryResponse,
|
|
12
|
+
ApiKeyCreateResponse,
|
|
13
|
+
AttachmentModel,
|
|
14
|
+
BatchProcessingStatus,
|
|
15
|
+
Bm25OperatorType,
|
|
16
|
+
CollectionStats,
|
|
17
|
+
ContentFilter,
|
|
18
|
+
ContentModel,
|
|
19
|
+
CortexModelsResponseCommonsActualErrorResponse,
|
|
20
|
+
CortexModelsResponseCommonsErrorResponse,
|
|
21
|
+
CustomPropertyDefinition,
|
|
22
|
+
DeleteResult,
|
|
23
|
+
DeleteUserMemoryResponse,
|
|
24
|
+
Entity,
|
|
25
|
+
ErrorResponse,
|
|
26
|
+
FetchMode,
|
|
27
|
+
ForcefulRelationsPayload,
|
|
28
|
+
GraphContext,
|
|
29
|
+
HttpValidationError,
|
|
30
|
+
Infra,
|
|
31
|
+
InfraStatusResponse,
|
|
32
|
+
IngestResponse,
|
|
33
|
+
InsertResult,
|
|
34
|
+
ListContentKind,
|
|
35
|
+
ListUserMemoriesResponse,
|
|
36
|
+
MemoryItem,
|
|
37
|
+
MemoryResultItem,
|
|
38
|
+
MilvusDataType,
|
|
39
|
+
PaginationMeta,
|
|
40
|
+
PathTriplet,
|
|
41
|
+
ProcessingStatus,
|
|
42
|
+
ProcessingStatusIndexingStatus,
|
|
43
|
+
QnASearchResponse,
|
|
44
|
+
RawEmbeddingDocument,
|
|
45
|
+
RawEmbeddingSearchResult,
|
|
46
|
+
RawEmbeddingVector,
|
|
47
|
+
RecallSearchRequest,
|
|
48
|
+
RecallSearchRequestAlpha,
|
|
49
|
+
RelationEvidence,
|
|
50
|
+
RetrievalResult,
|
|
51
|
+
RetrieveMode,
|
|
52
|
+
ScoredPathResponse,
|
|
53
|
+
SearchMode,
|
|
54
|
+
SourceDeleteResponse,
|
|
55
|
+
SourceDeleteResultItem,
|
|
56
|
+
SourceFetchResponse,
|
|
57
|
+
SourceGraphRelationsResponse,
|
|
58
|
+
SourceInfo,
|
|
59
|
+
SourceListResponse,
|
|
60
|
+
SourceModel,
|
|
61
|
+
SourceStatus,
|
|
62
|
+
SourceUploadResponse,
|
|
63
|
+
SourceUploadResultItem,
|
|
64
|
+
SubTenantIdsResponse,
|
|
65
|
+
SuperNodeItem,
|
|
66
|
+
SuperNodeResponse,
|
|
67
|
+
SupportedLlmProviders,
|
|
68
|
+
TenantCreateAcceptedResponse,
|
|
69
|
+
TenantDeleteResponse,
|
|
70
|
+
TenantIdsResponse,
|
|
71
|
+
TenantStatsResponse,
|
|
72
|
+
TripletWithEvidence,
|
|
73
|
+
UserAssistantPair,
|
|
74
|
+
UserMemory,
|
|
75
|
+
ValidationError,
|
|
76
|
+
ValidationErrorLocItem,
|
|
77
|
+
VectorStoreChunk,
|
|
78
|
+
)
|
|
79
|
+
from .errors import (
|
|
80
|
+
BadRequestError,
|
|
81
|
+
ForbiddenError,
|
|
82
|
+
InternalServerError,
|
|
83
|
+
NotFoundError,
|
|
84
|
+
ServiceUnavailableError,
|
|
85
|
+
TooManyRequestsError,
|
|
86
|
+
UnauthorizedError,
|
|
87
|
+
UnprocessableEntityError,
|
|
88
|
+
)
|
|
89
|
+
from . import data, embeddings, fetch, graph_health, ingestion_pipeline, key, recall, tenant, upload
|
|
90
|
+
from ._default_clients import DefaultAioHttpClient, DefaultAsyncHttpxClient
|
|
91
|
+
from .client import AsyncHydraDB, HydraDB
|
|
92
|
+
from .environment import HydraDBEnvironment
|
|
93
|
+
from .fetch import ListDataFetchResponse
|
|
94
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
95
|
+
"ActualErrorResponse": ".types",
|
|
96
|
+
"AddMemoryResponse": ".types",
|
|
97
|
+
"ApiKeyCreateResponse": ".types",
|
|
98
|
+
"AsyncHydraDB": ".client",
|
|
99
|
+
"AttachmentModel": ".types",
|
|
100
|
+
"BadRequestError": ".errors",
|
|
101
|
+
"BatchProcessingStatus": ".types",
|
|
102
|
+
"Bm25OperatorType": ".types",
|
|
103
|
+
"CollectionStats": ".types",
|
|
104
|
+
"ContentFilter": ".types",
|
|
105
|
+
"ContentModel": ".types",
|
|
106
|
+
"CortexModelsResponseCommonsActualErrorResponse": ".types",
|
|
107
|
+
"CortexModelsResponseCommonsErrorResponse": ".types",
|
|
108
|
+
"CustomPropertyDefinition": ".types",
|
|
109
|
+
"DefaultAioHttpClient": "._default_clients",
|
|
110
|
+
"DefaultAsyncHttpxClient": "._default_clients",
|
|
111
|
+
"DeleteResult": ".types",
|
|
112
|
+
"DeleteUserMemoryResponse": ".types",
|
|
113
|
+
"Entity": ".types",
|
|
114
|
+
"ErrorResponse": ".types",
|
|
115
|
+
"FetchMode": ".types",
|
|
116
|
+
"ForbiddenError": ".errors",
|
|
117
|
+
"ForcefulRelationsPayload": ".types",
|
|
118
|
+
"GraphContext": ".types",
|
|
119
|
+
"HttpValidationError": ".types",
|
|
120
|
+
"HydraDB": ".client",
|
|
121
|
+
"HydraDBEnvironment": ".environment",
|
|
122
|
+
"Infra": ".types",
|
|
123
|
+
"InfraStatusResponse": ".types",
|
|
124
|
+
"IngestResponse": ".types",
|
|
125
|
+
"InsertResult": ".types",
|
|
126
|
+
"InternalServerError": ".errors",
|
|
127
|
+
"ListContentKind": ".types",
|
|
128
|
+
"ListDataFetchResponse": ".fetch",
|
|
129
|
+
"ListUserMemoriesResponse": ".types",
|
|
130
|
+
"MemoryItem": ".types",
|
|
131
|
+
"MemoryResultItem": ".types",
|
|
132
|
+
"MilvusDataType": ".types",
|
|
133
|
+
"NotFoundError": ".errors",
|
|
134
|
+
"PaginationMeta": ".types",
|
|
135
|
+
"PathTriplet": ".types",
|
|
136
|
+
"ProcessingStatus": ".types",
|
|
137
|
+
"ProcessingStatusIndexingStatus": ".types",
|
|
138
|
+
"QnASearchResponse": ".types",
|
|
139
|
+
"RawEmbeddingDocument": ".types",
|
|
140
|
+
"RawEmbeddingSearchResult": ".types",
|
|
141
|
+
"RawEmbeddingVector": ".types",
|
|
142
|
+
"RecallSearchRequest": ".types",
|
|
143
|
+
"RecallSearchRequestAlpha": ".types",
|
|
144
|
+
"RelationEvidence": ".types",
|
|
145
|
+
"RetrievalResult": ".types",
|
|
146
|
+
"RetrieveMode": ".types",
|
|
147
|
+
"ScoredPathResponse": ".types",
|
|
148
|
+
"SearchMode": ".types",
|
|
149
|
+
"ServiceUnavailableError": ".errors",
|
|
150
|
+
"SourceDeleteResponse": ".types",
|
|
151
|
+
"SourceDeleteResultItem": ".types",
|
|
152
|
+
"SourceFetchResponse": ".types",
|
|
153
|
+
"SourceGraphRelationsResponse": ".types",
|
|
154
|
+
"SourceInfo": ".types",
|
|
155
|
+
"SourceListResponse": ".types",
|
|
156
|
+
"SourceModel": ".types",
|
|
157
|
+
"SourceStatus": ".types",
|
|
158
|
+
"SourceUploadResponse": ".types",
|
|
159
|
+
"SourceUploadResultItem": ".types",
|
|
160
|
+
"SubTenantIdsResponse": ".types",
|
|
161
|
+
"SuperNodeItem": ".types",
|
|
162
|
+
"SuperNodeResponse": ".types",
|
|
163
|
+
"SupportedLlmProviders": ".types",
|
|
164
|
+
"TenantCreateAcceptedResponse": ".types",
|
|
165
|
+
"TenantDeleteResponse": ".types",
|
|
166
|
+
"TenantIdsResponse": ".types",
|
|
167
|
+
"TenantStatsResponse": ".types",
|
|
168
|
+
"TooManyRequestsError": ".errors",
|
|
169
|
+
"TripletWithEvidence": ".types",
|
|
170
|
+
"UnauthorizedError": ".errors",
|
|
171
|
+
"UnprocessableEntityError": ".errors",
|
|
172
|
+
"UserAssistantPair": ".types",
|
|
173
|
+
"UserMemory": ".types",
|
|
174
|
+
"ValidationError": ".types",
|
|
175
|
+
"ValidationErrorLocItem": ".types",
|
|
176
|
+
"VectorStoreChunk": ".types",
|
|
177
|
+
"data": ".data",
|
|
178
|
+
"embeddings": ".embeddings",
|
|
179
|
+
"fetch": ".fetch",
|
|
180
|
+
"graph_health": ".graph_health",
|
|
181
|
+
"ingestion_pipeline": ".ingestion_pipeline",
|
|
182
|
+
"key": ".key",
|
|
183
|
+
"recall": ".recall",
|
|
184
|
+
"tenant": ".tenant",
|
|
185
|
+
"upload": ".upload",
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
190
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
191
|
+
if module_name is None:
|
|
192
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
193
|
+
try:
|
|
194
|
+
module = import_module(module_name, __package__)
|
|
195
|
+
if module_name == f".{attr_name}":
|
|
196
|
+
return module
|
|
197
|
+
else:
|
|
198
|
+
return getattr(module, attr_name)
|
|
199
|
+
except ImportError as e:
|
|
200
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
201
|
+
except AttributeError as e:
|
|
202
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def __dir__():
|
|
206
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
207
|
+
return sorted(lazy_attrs)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
__all__ = [
|
|
211
|
+
"ActualErrorResponse",
|
|
212
|
+
"AddMemoryResponse",
|
|
213
|
+
"ApiKeyCreateResponse",
|
|
214
|
+
"AsyncHydraDB",
|
|
215
|
+
"AttachmentModel",
|
|
216
|
+
"BadRequestError",
|
|
217
|
+
"BatchProcessingStatus",
|
|
218
|
+
"Bm25OperatorType",
|
|
219
|
+
"CollectionStats",
|
|
220
|
+
"ContentFilter",
|
|
221
|
+
"ContentModel",
|
|
222
|
+
"CortexModelsResponseCommonsActualErrorResponse",
|
|
223
|
+
"CortexModelsResponseCommonsErrorResponse",
|
|
224
|
+
"CustomPropertyDefinition",
|
|
225
|
+
"DefaultAioHttpClient",
|
|
226
|
+
"DefaultAsyncHttpxClient",
|
|
227
|
+
"DeleteResult",
|
|
228
|
+
"DeleteUserMemoryResponse",
|
|
229
|
+
"Entity",
|
|
230
|
+
"ErrorResponse",
|
|
231
|
+
"FetchMode",
|
|
232
|
+
"ForbiddenError",
|
|
233
|
+
"ForcefulRelationsPayload",
|
|
234
|
+
"GraphContext",
|
|
235
|
+
"HttpValidationError",
|
|
236
|
+
"HydraDB",
|
|
237
|
+
"HydraDBEnvironment",
|
|
238
|
+
"Infra",
|
|
239
|
+
"InfraStatusResponse",
|
|
240
|
+
"IngestResponse",
|
|
241
|
+
"InsertResult",
|
|
242
|
+
"InternalServerError",
|
|
243
|
+
"ListContentKind",
|
|
244
|
+
"ListDataFetchResponse",
|
|
245
|
+
"ListUserMemoriesResponse",
|
|
246
|
+
"MemoryItem",
|
|
247
|
+
"MemoryResultItem",
|
|
248
|
+
"MilvusDataType",
|
|
249
|
+
"NotFoundError",
|
|
250
|
+
"PaginationMeta",
|
|
251
|
+
"PathTriplet",
|
|
252
|
+
"ProcessingStatus",
|
|
253
|
+
"ProcessingStatusIndexingStatus",
|
|
254
|
+
"QnASearchResponse",
|
|
255
|
+
"RawEmbeddingDocument",
|
|
256
|
+
"RawEmbeddingSearchResult",
|
|
257
|
+
"RawEmbeddingVector",
|
|
258
|
+
"RecallSearchRequest",
|
|
259
|
+
"RecallSearchRequestAlpha",
|
|
260
|
+
"RelationEvidence",
|
|
261
|
+
"RetrievalResult",
|
|
262
|
+
"RetrieveMode",
|
|
263
|
+
"ScoredPathResponse",
|
|
264
|
+
"SearchMode",
|
|
265
|
+
"ServiceUnavailableError",
|
|
266
|
+
"SourceDeleteResponse",
|
|
267
|
+
"SourceDeleteResultItem",
|
|
268
|
+
"SourceFetchResponse",
|
|
269
|
+
"SourceGraphRelationsResponse",
|
|
270
|
+
"SourceInfo",
|
|
271
|
+
"SourceListResponse",
|
|
272
|
+
"SourceModel",
|
|
273
|
+
"SourceStatus",
|
|
274
|
+
"SourceUploadResponse",
|
|
275
|
+
"SourceUploadResultItem",
|
|
276
|
+
"SubTenantIdsResponse",
|
|
277
|
+
"SuperNodeItem",
|
|
278
|
+
"SuperNodeResponse",
|
|
279
|
+
"SupportedLlmProviders",
|
|
280
|
+
"TenantCreateAcceptedResponse",
|
|
281
|
+
"TenantDeleteResponse",
|
|
282
|
+
"TenantIdsResponse",
|
|
283
|
+
"TenantStatsResponse",
|
|
284
|
+
"TooManyRequestsError",
|
|
285
|
+
"TripletWithEvidence",
|
|
286
|
+
"UnauthorizedError",
|
|
287
|
+
"UnprocessableEntityError",
|
|
288
|
+
"UserAssistantPair",
|
|
289
|
+
"UserMemory",
|
|
290
|
+
"ValidationError",
|
|
291
|
+
"ValidationErrorLocItem",
|
|
292
|
+
"VectorStoreChunk",
|
|
293
|
+
"data",
|
|
294
|
+
"embeddings",
|
|
295
|
+
"fetch",
|
|
296
|
+
"graph_health",
|
|
297
|
+
"ingestion_pipeline",
|
|
298
|
+
"key",
|
|
299
|
+
"recall",
|
|
300
|
+
"tenant",
|
|
301
|
+
"upload",
|
|
302
|
+
]
|
|
@@ -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 package[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)
|