skyflow-flowvault-python 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.
- common/.coveragerc +4 -0
- common/__init__.py +3 -0
- common/client/__init__.py +0 -0
- common/client/base_skyflow.py +345 -0
- common/client/utils/__init__.py +1 -0
- common/client/utils/_utils.py +127 -0
- common/errors/__init__.py +1 -0
- common/errors/_skyflow_error.py +17 -0
- common/generated/__init__.py +0 -0
- common/generated/rest/__init__.py +24 -0
- common/generated/rest/authentication/__init__.py +4 -0
- common/generated/rest/authentication/client.py +181 -0
- common/generated/rest/authentication/raw_client.py +241 -0
- common/generated/rest/client.py +153 -0
- common/generated/rest/core/__init__.py +52 -0
- common/generated/rest/core/api_error.py +23 -0
- common/generated/rest/core/client_wrapper.py +86 -0
- common/generated/rest/core/datetime_utils.py +28 -0
- common/generated/rest/core/file.py +67 -0
- common/generated/rest/core/force_multipart.py +16 -0
- common/generated/rest/core/http_client.py +543 -0
- common/generated/rest/core/http_response.py +55 -0
- common/generated/rest/core/jsonable_encoder.py +100 -0
- common/generated/rest/core/pydantic_utilities.py +255 -0
- common/generated/rest/core/query_encoder.py +58 -0
- common/generated/rest/core/remove_none_from_dict.py +11 -0
- common/generated/rest/core/request_options.py +35 -0
- common/generated/rest/core/serialization.py +276 -0
- common/generated/rest/environment.py +8 -0
- common/generated/rest/errors/__init__.py +9 -0
- common/generated/rest/errors/bad_request_error.py +14 -0
- common/generated/rest/errors/not_found_error.py +14 -0
- common/generated/rest/errors/unauthorized_error.py +14 -0
- common/generated/rest/py.typed +0 -0
- common/generated/rest/types/__init__.py +9 -0
- common/generated/rest/types/googlerpc_status.py +22 -0
- common/generated/rest/types/protobuf_any.py +21 -0
- common/generated/rest/types/v_1_get_auth_token_response.py +33 -0
- common/generated/rest/version.py +6 -0
- common/service_account/__init__.py +1 -0
- common/service_account/_utils.py +248 -0
- common/service_account/client/__init__.py +0 -0
- common/service_account/client/auth_client.py +13 -0
- common/utils/__init__.py +4 -0
- common/utils/_helpers.py +18 -0
- common/utils/_skyflow_messages.py +445 -0
- common/utils/_utils.py +50 -0
- common/utils/constants.py +291 -0
- common/utils/enums/__init__.py +12 -0
- common/utils/enums/content_types.py +9 -0
- common/utils/enums/detect_entities.py +73 -0
- common/utils/enums/detect_output_transcriptions.py +8 -0
- common/utils/enums/env.py +13 -0
- common/utils/enums/log_level.py +8 -0
- common/utils/enums/masking_method.py +5 -0
- common/utils/enums/redaction_type.py +7 -0
- common/utils/enums/request_method.py +8 -0
- common/utils/enums/token_mode.py +6 -0
- common/utils/enums/token_type.py +6 -0
- common/utils/logger/__init__.py +2 -0
- common/utils/logger/_log_helpers.py +47 -0
- common/utils/logger/_logger.py +50 -0
- common/utils/validations/__init__.py +11 -0
- common/utils/validations/_validations.py +267 -0
- common/vault/base_vault_client.py +122 -0
- common/vault/base_vault_controller.py +58 -0
- common/vault/data/__init__.py +2 -0
- common/vault/data/_base_insert_request.py +7 -0
- common/vault/data/_base_insert_response.py +11 -0
- skyflow/__init__.py +2 -0
- skyflow/client/__init__.py +1 -0
- skyflow/client/_http_config_builder.py +45 -0
- skyflow/client/skyflow.py +15 -0
- skyflow/error/__init__.py +3 -0
- skyflow/generated/__init__.py +0 -0
- skyflow/generated/rest/__init__.py +164 -0
- skyflow/generated/rest/_default_clients.py +32 -0
- skyflow/generated/rest/client.py +385 -0
- skyflow/generated/rest/core/__init__.py +127 -0
- skyflow/generated/rest/core/api_error.py +23 -0
- skyflow/generated/rest/core/client_wrapper.py +148 -0
- skyflow/generated/rest/core/datetime_utils.py +70 -0
- skyflow/generated/rest/core/file.py +67 -0
- skyflow/generated/rest/core/force_multipart.py +18 -0
- skyflow/generated/rest/core/http_client.py +940 -0
- skyflow/generated/rest/core/http_response.py +63 -0
- skyflow/generated/rest/core/http_sse/__init__.py +42 -0
- skyflow/generated/rest/core/http_sse/_api.py +455 -0
- skyflow/generated/rest/core/http_sse/_decoders.py +74 -0
- skyflow/generated/rest/core/http_sse/_exceptions.py +7 -0
- skyflow/generated/rest/core/http_sse/_models.py +17 -0
- skyflow/generated/rest/core/jsonable_encoder.py +133 -0
- skyflow/generated/rest/core/logging.py +107 -0
- skyflow/generated/rest/core/parse_error.py +36 -0
- skyflow/generated/rest/core/pydantic_utilities.py +486 -0
- skyflow/generated/rest/core/query_encoder.py +58 -0
- skyflow/generated/rest/core/remove_none_from_dict.py +11 -0
- skyflow/generated/rest/core/request_options.py +40 -0
- skyflow/generated/rest/core/serialization.py +347 -0
- skyflow/generated/rest/environment.py +8 -0
- skyflow/generated/rest/errors/__init__.py +53 -0
- skyflow/generated/rest/errors/bad_request_error.py +11 -0
- skyflow/generated/rest/errors/forbidden_error.py +11 -0
- skyflow/generated/rest/errors/internal_server_error.py +11 -0
- skyflow/generated/rest/errors/not_found_error.py +11 -0
- skyflow/generated/rest/errors/too_many_requests_error.py +11 -0
- skyflow/generated/rest/errors/unauthorized_error.py +11 -0
- skyflow/generated/rest/py.typed +0 -0
- skyflow/generated/rest/query/__init__.py +4 -0
- skyflow/generated/rest/query/client.py +139 -0
- skyflow/generated/rest/query/raw_client.py +239 -0
- skyflow/generated/rest/raw_client.py +86 -0
- skyflow/generated/rest/records/__init__.py +34 -0
- skyflow/generated/rest/records/client.py +685 -0
- skyflow/generated/rest/records/raw_client.py +988 -0
- skyflow/generated/rest/records/types/__init__.py +34 -0
- skyflow/generated/rest/records/types/update_request_update_type.py +5 -0
- skyflow/generated/rest/tokens/__init__.py +4 -0
- skyflow/generated/rest/tokens/client.py +246 -0
- skyflow/generated/rest/tokens/raw_client.py +507 -0
- skyflow/generated/rest/types/__init__.py +116 -0
- skyflow/generated/rest/types/column_redactions.py +33 -0
- skyflow/generated/rest/types/delete_response.py +23 -0
- skyflow/generated/rest/types/delete_response_object.py +42 -0
- skyflow/generated/rest/types/detokenize_response.py +23 -0
- skyflow/generated/rest/types/detokenize_response_object.py +54 -0
- skyflow/generated/rest/types/error_response.py +20 -0
- skyflow/generated/rest/types/error_response_error.py +28 -0
- skyflow/generated/rest/types/execute_query_record_response.py +22 -0
- skyflow/generated/rest/types/execute_query_response.py +26 -0
- skyflow/generated/rest/types/execute_query_response_metadata.py +26 -0
- skyflow/generated/rest/types/get_request_data.py +60 -0
- skyflow/generated/rest/types/get_response.py +23 -0
- skyflow/generated/rest/types/get_tokens_from_values_request_object.py +30 -0
- skyflow/generated/rest/types/get_tokens_from_values_response.py +23 -0
- skyflow/generated/rest/types/google_protobuf_value.py +8 -0
- skyflow/generated/rest/types/http_code.py +6 -0
- skyflow/generated/rest/types/insert_record_data.py +36 -0
- skyflow/generated/rest/types/insert_response.py +23 -0
- skyflow/generated/rest/types/record_response_object.py +70 -0
- skyflow/generated/rest/types/token_group_redactions.py +33 -0
- skyflow/generated/rest/types/tokenize_response_object.py +49 -0
- skyflow/generated/rest/types/unique_value.py +22 -0
- skyflow/generated/rest/types/update_record_data.py +52 -0
- skyflow/generated/rest/types/update_record_data_update_type.py +5 -0
- skyflow/generated/rest/types/update_response.py +23 -0
- skyflow/generated/rest/types/upsert.py +45 -0
- skyflow/generated/rest/types/upsert_update_type.py +5 -0
- skyflow/generated/rest/version.py +6 -0
- skyflow/service_account/__init__.py +15 -0
- skyflow/utils/__init__.py +9 -0
- skyflow/utils/_http_config.py +36 -0
- skyflow/utils/_response_parsing.py +66 -0
- skyflow/utils/_retry.py +97 -0
- skyflow/utils/_skyflow_messages.py +114 -0
- skyflow/utils/_utils.py +54 -0
- skyflow/utils/_version.py +1 -0
- skyflow/utils/enums/__init__.py +3 -0
- skyflow/utils/enums/_custom_header_key.py +10 -0
- skyflow/utils/enums/_env_urls.py +9 -0
- skyflow/utils/enums/_upsert_type.py +7 -0
- skyflow/utils/validations/__init__.py +9 -0
- skyflow/utils/validations/_validations.py +195 -0
- skyflow/vault/__init__.py +0 -0
- skyflow/vault/client/__init__.py +0 -0
- skyflow/vault/client/client.py +102 -0
- skyflow/vault/controller/__init__.py +1 -0
- skyflow/vault/controller/_vault.py +475 -0
- skyflow/vault/data/__init__.py +30 -0
- skyflow/vault/data/_column_redactions.py +4 -0
- skyflow/vault/data/_delete_options.py +8 -0
- skyflow/vault/data/_delete_request.py +5 -0
- skyflow/vault/data/_delete_response.py +9 -0
- skyflow/vault/data/_delete_response_record.py +9 -0
- skyflow/vault/data/_detokenize_options.py +8 -0
- skyflow/vault/data/_detokenize_request.py +9 -0
- skyflow/vault/data/_detokenize_response.py +9 -0
- skyflow/vault/data/_detokenize_response_record.py +16 -0
- skyflow/vault/data/_detokenize_response_record_metadata.py +10 -0
- skyflow/vault/data/_get_options.py +8 -0
- skyflow/vault/data/_get_request.py +17 -0
- skyflow/vault/data/_get_request_record.py +13 -0
- skyflow/vault/data/_get_response.py +9 -0
- skyflow/vault/data/_get_response_record.py +17 -0
- skyflow/vault/data/_insert_options.py +8 -0
- skyflow/vault/data/_insert_request.py +11 -0
- skyflow/vault/data/_insert_request_record.py +9 -0
- skyflow/vault/data/_insert_response.py +9 -0
- skyflow/vault/data/_insert_response_record.py +17 -0
- skyflow/vault/data/_request_context.py +16 -0
- skyflow/vault/data/_token.py +8 -0
- skyflow/vault/data/_token_group_redactions.py +4 -0
- skyflow/vault/data/_update_options.py +8 -0
- skyflow/vault/data/_update_request.py +11 -0
- skyflow/vault/data/_update_request_record.py +6 -0
- skyflow/vault/data/_update_response.py +9 -0
- skyflow/vault/data/_update_response_record.py +17 -0
- skyflow/vault/data/_upsert_options.py +7 -0
- skyflow_flowvault_python-1.0.0.dist-info/METADATA +896 -0
- skyflow_flowvault_python-1.0.0.dist-info/RECORD +202 -0
- skyflow_flowvault_python-1.0.0.dist-info/WHEEL +5 -0
- skyflow_flowvault_python-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,164 @@
|
|
|
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
|
+
ColumnRedactions,
|
|
11
|
+
DeleteResponse,
|
|
12
|
+
DeleteResponseObject,
|
|
13
|
+
DetokenizeResponse,
|
|
14
|
+
DetokenizeResponseObject,
|
|
15
|
+
ErrorResponse,
|
|
16
|
+
ErrorResponseError,
|
|
17
|
+
ExecuteQueryRecordResponse,
|
|
18
|
+
ExecuteQueryResponse,
|
|
19
|
+
ExecuteQueryResponseMetadata,
|
|
20
|
+
GetRequestData,
|
|
21
|
+
GetResponse,
|
|
22
|
+
GetTokensFromValuesRequestObject,
|
|
23
|
+
GetTokensFromValuesResponse,
|
|
24
|
+
GoogleProtobufValue,
|
|
25
|
+
HttpCode,
|
|
26
|
+
InsertRecordData,
|
|
27
|
+
InsertResponse,
|
|
28
|
+
RecordResponseObject,
|
|
29
|
+
TokenGroupRedactions,
|
|
30
|
+
TokenizeResponseObject,
|
|
31
|
+
UniqueValue,
|
|
32
|
+
UpdateRecordData,
|
|
33
|
+
UpdateRecordDataUpdateType,
|
|
34
|
+
UpdateResponse,
|
|
35
|
+
Upsert,
|
|
36
|
+
UpsertUpdateType,
|
|
37
|
+
)
|
|
38
|
+
from .errors import (
|
|
39
|
+
BadRequestError,
|
|
40
|
+
ForbiddenError,
|
|
41
|
+
InternalServerError,
|
|
42
|
+
NotFoundError,
|
|
43
|
+
TooManyRequestsError,
|
|
44
|
+
UnauthorizedError,
|
|
45
|
+
)
|
|
46
|
+
from . import query, records, tokens
|
|
47
|
+
from ._default_clients import DefaultAioHttpClient, DefaultAsyncHttpxClient
|
|
48
|
+
from .client import AsyncSkyflowAuth, SkyflowAuth
|
|
49
|
+
from .environment import SkyflowAuthEnvironment
|
|
50
|
+
from .records import UpdateRequestUpdateType
|
|
51
|
+
from .version import __version__
|
|
52
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
53
|
+
"AsyncSkyflowAuth": ".client",
|
|
54
|
+
"BadRequestError": ".errors",
|
|
55
|
+
"ColumnRedactions": ".types",
|
|
56
|
+
"DefaultAioHttpClient": "._default_clients",
|
|
57
|
+
"DefaultAsyncHttpxClient": "._default_clients",
|
|
58
|
+
"DeleteResponse": ".types",
|
|
59
|
+
"DeleteResponseObject": ".types",
|
|
60
|
+
"DetokenizeResponse": ".types",
|
|
61
|
+
"DetokenizeResponseObject": ".types",
|
|
62
|
+
"ErrorResponse": ".types",
|
|
63
|
+
"ErrorResponseError": ".types",
|
|
64
|
+
"ExecuteQueryRecordResponse": ".types",
|
|
65
|
+
"ExecuteQueryResponse": ".types",
|
|
66
|
+
"ExecuteQueryResponseMetadata": ".types",
|
|
67
|
+
"ForbiddenError": ".errors",
|
|
68
|
+
"GetRequestData": ".types",
|
|
69
|
+
"GetResponse": ".types",
|
|
70
|
+
"GetTokensFromValuesRequestObject": ".types",
|
|
71
|
+
"GetTokensFromValuesResponse": ".types",
|
|
72
|
+
"GoogleProtobufValue": ".types",
|
|
73
|
+
"HttpCode": ".types",
|
|
74
|
+
"InsertRecordData": ".types",
|
|
75
|
+
"InsertResponse": ".types",
|
|
76
|
+
"InternalServerError": ".errors",
|
|
77
|
+
"NotFoundError": ".errors",
|
|
78
|
+
"RecordResponseObject": ".types",
|
|
79
|
+
"SkyflowAuth": ".client",
|
|
80
|
+
"SkyflowAuthEnvironment": ".environment",
|
|
81
|
+
"TokenGroupRedactions": ".types",
|
|
82
|
+
"TokenizeResponseObject": ".types",
|
|
83
|
+
"TooManyRequestsError": ".errors",
|
|
84
|
+
"UnauthorizedError": ".errors",
|
|
85
|
+
"UniqueValue": ".types",
|
|
86
|
+
"UpdateRecordData": ".types",
|
|
87
|
+
"UpdateRecordDataUpdateType": ".types",
|
|
88
|
+
"UpdateRequestUpdateType": ".records",
|
|
89
|
+
"UpdateResponse": ".types",
|
|
90
|
+
"Upsert": ".types",
|
|
91
|
+
"UpsertUpdateType": ".types",
|
|
92
|
+
"__version__": ".version",
|
|
93
|
+
"query": ".query",
|
|
94
|
+
"records": ".records",
|
|
95
|
+
"tokens": ".tokens",
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
100
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
101
|
+
if module_name is None:
|
|
102
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
103
|
+
try:
|
|
104
|
+
module = import_module(module_name, __package__)
|
|
105
|
+
if module_name == f".{attr_name}":
|
|
106
|
+
return module
|
|
107
|
+
else:
|
|
108
|
+
return getattr(module, attr_name)
|
|
109
|
+
except ImportError as e:
|
|
110
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
111
|
+
except AttributeError as e:
|
|
112
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def __dir__():
|
|
116
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
117
|
+
return sorted(lazy_attrs)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
__all__ = [
|
|
121
|
+
"AsyncSkyflowAuth",
|
|
122
|
+
"BadRequestError",
|
|
123
|
+
"ColumnRedactions",
|
|
124
|
+
"DefaultAioHttpClient",
|
|
125
|
+
"DefaultAsyncHttpxClient",
|
|
126
|
+
"DeleteResponse",
|
|
127
|
+
"DeleteResponseObject",
|
|
128
|
+
"DetokenizeResponse",
|
|
129
|
+
"DetokenizeResponseObject",
|
|
130
|
+
"ErrorResponse",
|
|
131
|
+
"ErrorResponseError",
|
|
132
|
+
"ExecuteQueryRecordResponse",
|
|
133
|
+
"ExecuteQueryResponse",
|
|
134
|
+
"ExecuteQueryResponseMetadata",
|
|
135
|
+
"ForbiddenError",
|
|
136
|
+
"GetRequestData",
|
|
137
|
+
"GetResponse",
|
|
138
|
+
"GetTokensFromValuesRequestObject",
|
|
139
|
+
"GetTokensFromValuesResponse",
|
|
140
|
+
"GoogleProtobufValue",
|
|
141
|
+
"HttpCode",
|
|
142
|
+
"InsertRecordData",
|
|
143
|
+
"InsertResponse",
|
|
144
|
+
"InternalServerError",
|
|
145
|
+
"NotFoundError",
|
|
146
|
+
"RecordResponseObject",
|
|
147
|
+
"SkyflowAuth",
|
|
148
|
+
"SkyflowAuthEnvironment",
|
|
149
|
+
"TokenGroupRedactions",
|
|
150
|
+
"TokenizeResponseObject",
|
|
151
|
+
"TooManyRequestsError",
|
|
152
|
+
"UnauthorizedError",
|
|
153
|
+
"UniqueValue",
|
|
154
|
+
"UpdateRecordData",
|
|
155
|
+
"UpdateRecordDataUpdateType",
|
|
156
|
+
"UpdateRequestUpdateType",
|
|
157
|
+
"UpdateResponse",
|
|
158
|
+
"Upsert",
|
|
159
|
+
"UpsertUpdateType",
|
|
160
|
+
"__version__",
|
|
161
|
+
"query",
|
|
162
|
+
"records",
|
|
163
|
+
"tokens",
|
|
164
|
+
]
|
|
@@ -0,0 +1,32 @@
|
|
|
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(
|
|
16
|
+
"To use the aiohttp client, install the aiohttp extra: pip install skyflow.generated.rest[aiohttp]"
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
else:
|
|
20
|
+
|
|
21
|
+
class DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
|
|
22
|
+
def __init__(self, **kwargs: typing.Any) -> None:
|
|
23
|
+
kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
|
|
24
|
+
kwargs.setdefault("follow_redirects", True)
|
|
25
|
+
super().__init__(**kwargs)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class DefaultAsyncHttpxClient(httpx.AsyncClient):
|
|
29
|
+
def __init__(self, **kwargs: typing.Any) -> None:
|
|
30
|
+
kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
|
|
31
|
+
kwargs.setdefault("follow_redirects", True)
|
|
32
|
+
super().__init__(**kwargs)
|
|
@@ -0,0 +1,385 @@
|
|
|
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 .core.request_options import RequestOptions
|
|
11
|
+
from .environment import SkyflowAuthEnvironment
|
|
12
|
+
from .raw_client import AsyncRawSkyflowAuth, RawSkyflowAuth
|
|
13
|
+
|
|
14
|
+
if typing.TYPE_CHECKING:
|
|
15
|
+
from .query.client import AsyncQueryClient, QueryClient
|
|
16
|
+
from .records.client import AsyncRecordsClient, RecordsClient
|
|
17
|
+
from .tokens.client import AsyncTokensClient, TokensClient
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class SkyflowAuth:
|
|
21
|
+
"""
|
|
22
|
+
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.
|
|
23
|
+
|
|
24
|
+
Parameters
|
|
25
|
+
----------
|
|
26
|
+
base_url : typing.Optional[str]
|
|
27
|
+
The base url to use for requests from the client.
|
|
28
|
+
|
|
29
|
+
environment : SkyflowAuthEnvironment
|
|
30
|
+
The environment to use for requests from the client. from .environment import SkyflowAuthEnvironment
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
Defaults to SkyflowAuthEnvironment.PRODUCTION
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
vault_url : typing.Optional[str]
|
|
39
|
+
Server URL variable for 'vault_url'. Defaults to '{{vault_url}}'.
|
|
40
|
+
|
|
41
|
+
token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
|
|
42
|
+
headers : typing.Optional[typing.Dict[str, str]]
|
|
43
|
+
Additional headers to send with every request.
|
|
44
|
+
|
|
45
|
+
timeout : typing.Optional[float]
|
|
46
|
+
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.
|
|
47
|
+
|
|
48
|
+
max_retries : typing.Optional[int]
|
|
49
|
+
The default maximum number of retries for failed requests. Defaults to 2. Per-request `max_retries` in `request_options` takes precedence over this value.
|
|
50
|
+
|
|
51
|
+
stream_reconnection_enabled : typing.Optional[bool]
|
|
52
|
+
Whether to automatically reconnect on stream disconnection for resumable streaming endpoints. Defaults to True. Per-request `stream_reconnection_enabled` in `request_options` takes precedence over this value.
|
|
53
|
+
|
|
54
|
+
max_stream_reconnection_attempts : typing.Optional[int]
|
|
55
|
+
The maximum number of reconnection attempts for resumable streaming endpoints. Defaults to no limit. Per-request `max_stream_reconnection_attempts` in `request_options` takes precedence over this value.
|
|
56
|
+
|
|
57
|
+
follow_redirects : typing.Optional[bool]
|
|
58
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
59
|
+
|
|
60
|
+
httpx_client : typing.Optional[httpx.Client]
|
|
61
|
+
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.
|
|
62
|
+
|
|
63
|
+
logging : typing.Optional[typing.Union[LogConfig, Logger]]
|
|
64
|
+
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.
|
|
65
|
+
|
|
66
|
+
Examples
|
|
67
|
+
--------
|
|
68
|
+
from skyflow import SkyflowAuth
|
|
69
|
+
|
|
70
|
+
client = SkyflowAuth(
|
|
71
|
+
token="YOUR_TOKEN",
|
|
72
|
+
)
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
def __init__(
|
|
76
|
+
self,
|
|
77
|
+
*,
|
|
78
|
+
base_url: typing.Optional[str] = None,
|
|
79
|
+
environment: SkyflowAuthEnvironment = SkyflowAuthEnvironment.PRODUCTION,
|
|
80
|
+
vault_url: typing.Optional[str] = None,
|
|
81
|
+
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
|
|
82
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
83
|
+
timeout: typing.Optional[float] = None,
|
|
84
|
+
max_retries: typing.Optional[int] = None,
|
|
85
|
+
stream_reconnection_enabled: typing.Optional[bool] = None,
|
|
86
|
+
max_stream_reconnection_attempts: typing.Optional[int] = None,
|
|
87
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
88
|
+
httpx_client: typing.Optional[httpx.Client] = None,
|
|
89
|
+
logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
|
|
90
|
+
):
|
|
91
|
+
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
|
|
92
|
+
_defaulted_max_retries = max_retries if max_retries is not None else 2
|
|
93
|
+
if vault_url is not None:
|
|
94
|
+
_vault_url = vault_url if vault_url is not None else "{{vault_url}}"
|
|
95
|
+
_environment_url_templates = {
|
|
96
|
+
SkyflowAuthEnvironment.PRODUCTION: "https://{vault_url}",
|
|
97
|
+
SkyflowAuthEnvironment.SANDBOX: "https://{vault_url}",
|
|
98
|
+
}
|
|
99
|
+
_url_template = _environment_url_templates.get(environment, "https://{vault_url}")
|
|
100
|
+
if base_url is None:
|
|
101
|
+
base_url = _url_template.format(vault_url=_vault_url)
|
|
102
|
+
self._client_wrapper = SyncClientWrapper(
|
|
103
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
104
|
+
token=token,
|
|
105
|
+
headers=headers,
|
|
106
|
+
httpx_client=httpx_client
|
|
107
|
+
if httpx_client is not None
|
|
108
|
+
else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
|
109
|
+
if follow_redirects is not None
|
|
110
|
+
else httpx.Client(timeout=_defaulted_timeout),
|
|
111
|
+
timeout=_defaulted_timeout,
|
|
112
|
+
max_retries=_defaulted_max_retries,
|
|
113
|
+
stream_reconnection_enabled=stream_reconnection_enabled,
|
|
114
|
+
max_stream_reconnection_attempts=max_stream_reconnection_attempts,
|
|
115
|
+
logging=logging,
|
|
116
|
+
)
|
|
117
|
+
self._raw_client = RawSkyflowAuth(client_wrapper=self._client_wrapper)
|
|
118
|
+
self._query: typing.Optional[QueryClient] = None
|
|
119
|
+
self._records: typing.Optional[RecordsClient] = None
|
|
120
|
+
self._tokens: typing.Optional[TokensClient] = None
|
|
121
|
+
|
|
122
|
+
@property
|
|
123
|
+
def with_raw_response(self) -> RawSkyflowAuth:
|
|
124
|
+
"""
|
|
125
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
126
|
+
|
|
127
|
+
Returns
|
|
128
|
+
-------
|
|
129
|
+
RawSkyflowAuth
|
|
130
|
+
"""
|
|
131
|
+
return self._raw_client
|
|
132
|
+
|
|
133
|
+
def patch_v2vaults_id(
|
|
134
|
+
self, vault_id: typing.Optional[str], *, request_options: typing.Optional[RequestOptions] = None
|
|
135
|
+
) -> None:
|
|
136
|
+
"""
|
|
137
|
+
Parameters
|
|
138
|
+
----------
|
|
139
|
+
vault_id : typing.Optional[str]
|
|
140
|
+
|
|
141
|
+
request_options : typing.Optional[RequestOptions]
|
|
142
|
+
Request-specific configuration.
|
|
143
|
+
|
|
144
|
+
Returns
|
|
145
|
+
-------
|
|
146
|
+
None
|
|
147
|
+
|
|
148
|
+
Examples
|
|
149
|
+
--------
|
|
150
|
+
from skyflow import SkyflowAuth
|
|
151
|
+
|
|
152
|
+
client = SkyflowAuth(
|
|
153
|
+
token="YOUR_TOKEN",
|
|
154
|
+
)
|
|
155
|
+
client.patch_v2vaults_id()
|
|
156
|
+
"""
|
|
157
|
+
_response = self._raw_client.patch_v2vaults_id(vault_id, request_options=request_options)
|
|
158
|
+
return _response.data
|
|
159
|
+
|
|
160
|
+
@property
|
|
161
|
+
def query(self):
|
|
162
|
+
if self._query is None:
|
|
163
|
+
from .query.client import QueryClient # noqa: E402
|
|
164
|
+
|
|
165
|
+
self._query = QueryClient(client_wrapper=self._client_wrapper)
|
|
166
|
+
return self._query
|
|
167
|
+
|
|
168
|
+
@property
|
|
169
|
+
def records(self):
|
|
170
|
+
if self._records is None:
|
|
171
|
+
from .records.client import RecordsClient # noqa: E402
|
|
172
|
+
|
|
173
|
+
self._records = RecordsClient(client_wrapper=self._client_wrapper)
|
|
174
|
+
return self._records
|
|
175
|
+
|
|
176
|
+
@property
|
|
177
|
+
def tokens(self):
|
|
178
|
+
if self._tokens is None:
|
|
179
|
+
from .tokens.client import TokensClient # noqa: E402
|
|
180
|
+
|
|
181
|
+
self._tokens = TokensClient(client_wrapper=self._client_wrapper)
|
|
182
|
+
return self._tokens
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def _make_default_async_client(
|
|
186
|
+
timeout: typing.Optional[float],
|
|
187
|
+
follow_redirects: typing.Optional[bool],
|
|
188
|
+
) -> httpx.AsyncClient:
|
|
189
|
+
try:
|
|
190
|
+
import httpx_aiohttp # type: ignore[import-not-found]
|
|
191
|
+
except ImportError:
|
|
192
|
+
pass
|
|
193
|
+
else:
|
|
194
|
+
if follow_redirects is not None:
|
|
195
|
+
return httpx_aiohttp.HttpxAiohttpClient(timeout=timeout, follow_redirects=follow_redirects)
|
|
196
|
+
return httpx_aiohttp.HttpxAiohttpClient(timeout=timeout)
|
|
197
|
+
|
|
198
|
+
if follow_redirects is not None:
|
|
199
|
+
return httpx.AsyncClient(timeout=timeout, follow_redirects=follow_redirects)
|
|
200
|
+
return httpx.AsyncClient(timeout=timeout)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
class AsyncSkyflowAuth:
|
|
204
|
+
"""
|
|
205
|
+
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.
|
|
206
|
+
|
|
207
|
+
Parameters
|
|
208
|
+
----------
|
|
209
|
+
base_url : typing.Optional[str]
|
|
210
|
+
The base url to use for requests from the client.
|
|
211
|
+
|
|
212
|
+
environment : SkyflowAuthEnvironment
|
|
213
|
+
The environment to use for requests from the client. from .environment import SkyflowAuthEnvironment
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
Defaults to SkyflowAuthEnvironment.PRODUCTION
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
vault_url : typing.Optional[str]
|
|
222
|
+
Server URL variable for 'vault_url'. Defaults to '{{vault_url}}'.
|
|
223
|
+
|
|
224
|
+
token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
|
|
225
|
+
headers : typing.Optional[typing.Dict[str, str]]
|
|
226
|
+
Additional headers to send with every request.
|
|
227
|
+
|
|
228
|
+
async_token : typing.Optional[typing.Callable[[], typing.Awaitable[str]]]
|
|
229
|
+
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.
|
|
230
|
+
|
|
231
|
+
timeout : typing.Optional[float]
|
|
232
|
+
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.
|
|
233
|
+
|
|
234
|
+
max_retries : typing.Optional[int]
|
|
235
|
+
The default maximum number of retries for failed requests. Defaults to 2. Per-request `max_retries` in `request_options` takes precedence over this value.
|
|
236
|
+
|
|
237
|
+
stream_reconnection_enabled : typing.Optional[bool]
|
|
238
|
+
Whether to automatically reconnect on stream disconnection for resumable streaming endpoints. Defaults to True. Per-request `stream_reconnection_enabled` in `request_options` takes precedence over this value.
|
|
239
|
+
|
|
240
|
+
max_stream_reconnection_attempts : typing.Optional[int]
|
|
241
|
+
The maximum number of reconnection attempts for resumable streaming endpoints. Defaults to no limit. Per-request `max_stream_reconnection_attempts` in `request_options` takes precedence over this value.
|
|
242
|
+
|
|
243
|
+
follow_redirects : typing.Optional[bool]
|
|
244
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
245
|
+
|
|
246
|
+
httpx_client : typing.Optional[httpx.AsyncClient]
|
|
247
|
+
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.
|
|
248
|
+
|
|
249
|
+
logging : typing.Optional[typing.Union[LogConfig, Logger]]
|
|
250
|
+
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.
|
|
251
|
+
|
|
252
|
+
Examples
|
|
253
|
+
--------
|
|
254
|
+
from skyflow import AsyncSkyflowAuth
|
|
255
|
+
|
|
256
|
+
client = AsyncSkyflowAuth(
|
|
257
|
+
token="YOUR_TOKEN",
|
|
258
|
+
)
|
|
259
|
+
"""
|
|
260
|
+
|
|
261
|
+
def __init__(
|
|
262
|
+
self,
|
|
263
|
+
*,
|
|
264
|
+
base_url: typing.Optional[str] = None,
|
|
265
|
+
environment: SkyflowAuthEnvironment = SkyflowAuthEnvironment.PRODUCTION,
|
|
266
|
+
vault_url: typing.Optional[str] = None,
|
|
267
|
+
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
|
|
268
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
269
|
+
async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None,
|
|
270
|
+
timeout: typing.Optional[float] = None,
|
|
271
|
+
max_retries: typing.Optional[int] = None,
|
|
272
|
+
stream_reconnection_enabled: typing.Optional[bool] = None,
|
|
273
|
+
max_stream_reconnection_attempts: typing.Optional[int] = None,
|
|
274
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
275
|
+
httpx_client: typing.Optional[httpx.AsyncClient] = None,
|
|
276
|
+
logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
|
|
277
|
+
):
|
|
278
|
+
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
|
|
279
|
+
_defaulted_max_retries = max_retries if max_retries is not None else 2
|
|
280
|
+
if vault_url is not None:
|
|
281
|
+
_vault_url = vault_url if vault_url is not None else "{{vault_url}}"
|
|
282
|
+
_environment_url_templates = {
|
|
283
|
+
SkyflowAuthEnvironment.PRODUCTION: "https://{vault_url}",
|
|
284
|
+
SkyflowAuthEnvironment.SANDBOX: "https://{vault_url}",
|
|
285
|
+
}
|
|
286
|
+
_url_template = _environment_url_templates.get(environment, "https://{vault_url}")
|
|
287
|
+
if base_url is None:
|
|
288
|
+
base_url = _url_template.format(vault_url=_vault_url)
|
|
289
|
+
self._client_wrapper = AsyncClientWrapper(
|
|
290
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
291
|
+
token=token,
|
|
292
|
+
headers=headers,
|
|
293
|
+
async_token=async_token,
|
|
294
|
+
httpx_client=httpx_client
|
|
295
|
+
if httpx_client is not None
|
|
296
|
+
else _make_default_async_client(timeout=_defaulted_timeout, follow_redirects=follow_redirects),
|
|
297
|
+
timeout=_defaulted_timeout,
|
|
298
|
+
max_retries=_defaulted_max_retries,
|
|
299
|
+
stream_reconnection_enabled=stream_reconnection_enabled,
|
|
300
|
+
max_stream_reconnection_attempts=max_stream_reconnection_attempts,
|
|
301
|
+
logging=logging,
|
|
302
|
+
)
|
|
303
|
+
self._raw_client = AsyncRawSkyflowAuth(client_wrapper=self._client_wrapper)
|
|
304
|
+
self._query: typing.Optional[AsyncQueryClient] = None
|
|
305
|
+
self._records: typing.Optional[AsyncRecordsClient] = None
|
|
306
|
+
self._tokens: typing.Optional[AsyncTokensClient] = None
|
|
307
|
+
|
|
308
|
+
@property
|
|
309
|
+
def with_raw_response(self) -> AsyncRawSkyflowAuth:
|
|
310
|
+
"""
|
|
311
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
312
|
+
|
|
313
|
+
Returns
|
|
314
|
+
-------
|
|
315
|
+
AsyncRawSkyflowAuth
|
|
316
|
+
"""
|
|
317
|
+
return self._raw_client
|
|
318
|
+
|
|
319
|
+
async def patch_v2vaults_id(
|
|
320
|
+
self, vault_id: typing.Optional[str], *, request_options: typing.Optional[RequestOptions] = None
|
|
321
|
+
) -> None:
|
|
322
|
+
"""
|
|
323
|
+
Parameters
|
|
324
|
+
----------
|
|
325
|
+
vault_id : typing.Optional[str]
|
|
326
|
+
|
|
327
|
+
request_options : typing.Optional[RequestOptions]
|
|
328
|
+
Request-specific configuration.
|
|
329
|
+
|
|
330
|
+
Returns
|
|
331
|
+
-------
|
|
332
|
+
None
|
|
333
|
+
|
|
334
|
+
Examples
|
|
335
|
+
--------
|
|
336
|
+
import asyncio
|
|
337
|
+
|
|
338
|
+
from skyflow import AsyncSkyflowAuth
|
|
339
|
+
|
|
340
|
+
client = AsyncSkyflowAuth(
|
|
341
|
+
token="YOUR_TOKEN",
|
|
342
|
+
)
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
async def main() -> None:
|
|
346
|
+
await client.patch_v2vaults_id()
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
asyncio.run(main())
|
|
350
|
+
"""
|
|
351
|
+
_response = await self._raw_client.patch_v2vaults_id(vault_id, request_options=request_options)
|
|
352
|
+
return _response.data
|
|
353
|
+
|
|
354
|
+
@property
|
|
355
|
+
def query(self):
|
|
356
|
+
if self._query is None:
|
|
357
|
+
from .query.client import AsyncQueryClient # noqa: E402
|
|
358
|
+
|
|
359
|
+
self._query = AsyncQueryClient(client_wrapper=self._client_wrapper)
|
|
360
|
+
return self._query
|
|
361
|
+
|
|
362
|
+
@property
|
|
363
|
+
def records(self):
|
|
364
|
+
if self._records is None:
|
|
365
|
+
from .records.client import AsyncRecordsClient # noqa: E402
|
|
366
|
+
|
|
367
|
+
self._records = AsyncRecordsClient(client_wrapper=self._client_wrapper)
|
|
368
|
+
return self._records
|
|
369
|
+
|
|
370
|
+
@property
|
|
371
|
+
def tokens(self):
|
|
372
|
+
if self._tokens is None:
|
|
373
|
+
from .tokens.client import AsyncTokensClient # noqa: E402
|
|
374
|
+
|
|
375
|
+
self._tokens = AsyncTokensClient(client_wrapper=self._client_wrapper)
|
|
376
|
+
return self._tokens
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: SkyflowAuthEnvironment) -> str:
|
|
380
|
+
if base_url is not None:
|
|
381
|
+
return base_url
|
|
382
|
+
elif environment is not None:
|
|
383
|
+
return environment.value
|
|
384
|
+
else:
|
|
385
|
+
raise Exception("Please pass in either base_url or environment to construct the client")
|