mixpeek 0.1.2__py3-none-any.whl → 0.3__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.
- mixpeek/__init__.py +70 -6
- mixpeek-0.3.dist-info/LICENSE.rst +20 -0
- mixpeek-0.3.dist-info/METADATA +12 -0
- mixpeek-0.3.dist-info/RECORD +6 -0
- {mixpeek-0.1.2.dist-info → mixpeek-0.3.dist-info}/WHEEL +2 -1
- mixpeek-0.3.dist-info/top_level.txt +1 -0
- mixpeek/_hooks/__init__.py +0 -5
- mixpeek/_hooks/registration.py +0 -13
- mixpeek/_hooks/sdkhooks.py +0 -76
- mixpeek/_hooks/types.py +0 -94
- mixpeek/_version.py +0 -12
- mixpeek/assets.py +0 -1561
- mixpeek/basesdk.py +0 -350
- mixpeek/collections.py +0 -1029
- mixpeek/featureextractors.py +0 -205
- mixpeek/features.py +0 -1181
- mixpeek/health.py +0 -167
- mixpeek/httpclient.py +0 -84
- mixpeek/ingest.py +0 -831
- mixpeek/interactions.py +0 -221
- mixpeek/models/__init__.py +0 -751
- mixpeek/models/actionusage.py +0 -16
- mixpeek/models/apierror.py +0 -22
- mixpeek/models/apikey.py +0 -25
- mixpeek/models/apikeyupdate.py +0 -49
- mixpeek/models/assetfeatures.py +0 -55
- mixpeek/models/assetresponse.py +0 -166
- mixpeek/models/assets_model_searchquery.py +0 -21
- mixpeek/models/assetupdate.py +0 -28
- mixpeek/models/availableindexesresponse.py +0 -23
- mixpeek/models/availablemodels.py +0 -12
- mixpeek/models/boolindexparams.py +0 -18
- mixpeek/models/collectionmodel.py +0 -70
- mixpeek/models/collectionresult.py +0 -73
- mixpeek/models/create_api_key_organizations_users_user_email_api_keys_postop.py +0 -23
- mixpeek/models/create_collection_collections_postop.py +0 -62
- mixpeek/models/create_interaction_features_search_interactions_postop.py +0 -59
- mixpeek/models/createcollectionrequest.py +0 -59
- mixpeek/models/createnamespacerequest.py +0 -62
- mixpeek/models/datetimeindexparams.py +0 -18
- mixpeek/models/dateusage.py +0 -22
- mixpeek/models/db_model_paginationresponse.py +0 -59
- mixpeek/models/db_model_taskresponse.py +0 -20
- mixpeek/models/delete_api_key_organizations_users_user_email_api_keys_key_name_deleteop.py +0 -23
- mixpeek/models/delete_asset_assets_asset_id_deleteop.py +0 -57
- mixpeek/models/delete_collection_collections_collection_deleteop.py +0 -59
- mixpeek/models/delete_feature_features_feature_id_deleteop.py +0 -57
- mixpeek/models/delete_interaction_features_search_interactions_interaction_id_deleteop.py +0 -59
- mixpeek/models/delete_namespace_namespaces_namespace_deleteop.py +0 -18
- mixpeek/models/delete_user_organizations_users_user_email_deleteop.py +0 -16
- mixpeek/models/denseembedding.py +0 -16
- mixpeek/models/embeddingrequest.py +0 -59
- mixpeek/models/embeddingresponse.py +0 -64
- mixpeek/models/errormessage.py +0 -13
- mixpeek/models/errorresponse.py +0 -21
- mixpeek/models/facedetectsettings.py +0 -52
- mixpeek/models/featureextractionembeddingrequest.py +0 -54
- mixpeek/models/featureresponse.py +0 -74
- mixpeek/models/features_model_paginationresponse.py +0 -59
- mixpeek/models/featureupdaterequest.py +0 -21
- mixpeek/models/filtercondition.py +0 -74
- mixpeek/models/floatindexparams.py +0 -18
- mixpeek/models/full_asset_update_assets_asset_id_putop.py +0 -69
- mixpeek/models/full_feature_update_features_feature_id_putop.py +0 -69
- mixpeek/models/geoindexparams.py +0 -18
- mixpeek/models/get_asset_assets_asset_id_getop.py +0 -73
- mixpeek/models/get_asset_with_features_assets_asset_id_features_getop.py +0 -73
- mixpeek/models/get_collection_collections_collection_getop.py +0 -59
- mixpeek/models/get_feature_features_feature_id_getop.py +0 -70
- mixpeek/models/get_interaction_features_search_interactions_interaction_id_getop.py +0 -59
- mixpeek/models/get_namespace_namespaces_namespace_getop.py +0 -18
- mixpeek/models/get_task_tasks_task_id_getop.py +0 -57
- mixpeek/models/get_user_organizations_users_user_email_getop.py +0 -16
- mixpeek/models/groupbyoptions.py +0 -71
- mixpeek/models/groupbyoptionsasset.py +0 -71
- mixpeek/models/groupedassetdata.py +0 -18
- mixpeek/models/healthcheckresponse.py +0 -13
- mixpeek/models/httpvalidationerror.py +0 -21
- mixpeek/models/imagedescribesettings.py +0 -82
- mixpeek/models/imagedetectsettings.py +0 -53
- mixpeek/models/imagereadsettings.py +0 -71
- mixpeek/models/imagesettings.py +0 -79
- mixpeek/models/ingest_image_url_ingest_images_url_postop.py +0 -59
- mixpeek/models/ingest_text_ingest_text_postop.py +0 -59
- mixpeek/models/ingest_video_url_ingest_videos_url_postop.py +0 -59
- mixpeek/models/inputtype.py +0 -11
- mixpeek/models/integerindexparams.py +0 -24
- mixpeek/models/interactionresponse.py +0 -87
- mixpeek/models/interactiontype.py +0 -11
- mixpeek/models/jsonimageoutputsettings.py +0 -55
- mixpeek/models/jsontextoutputsettings.py +0 -55
- mixpeek/models/jsonvideooutputsettings.py +0 -55
- mixpeek/models/keywordindexparams.py +0 -21
- mixpeek/models/kill_task_tasks_task_id_deleteop.py +0 -57
- mixpeek/models/list_assets_assets_postop.py +0 -77
- mixpeek/models/list_collections_collections_getop.py +0 -65
- mixpeek/models/list_features_features_postop.py +0 -79
- mixpeek/models/list_interactions_features_search_interactions_getop.py +0 -96
- mixpeek/models/listassetsrequest.py +0 -75
- mixpeek/models/listassetsresponse.py +0 -22
- mixpeek/models/listcollectionsresponse.py +0 -22
- mixpeek/models/listfeaturesrequest.py +0 -77
- mixpeek/models/listfeaturesresponse.py +0 -22
- mixpeek/models/logicaloperator_input.py +0 -88
- mixpeek/models/logicaloperator_output.py +0 -103
- mixpeek/models/logodetectsettings.py +0 -52
- mixpeek/models/modality.py +0 -13
- mixpeek/models/modeldetails.py +0 -57
- mixpeek/models/namespaceresponse.py +0 -54
- mixpeek/models/organizationmodel.py +0 -45
- mixpeek/models/partial_asset_update_assets_asset_id_patchop.py +0 -69
- mixpeek/models/payloadindexconfig.py +0 -94
- mixpeek/models/payloadindextype.py +0 -17
- mixpeek/models/payloadschematype.py +0 -15
- mixpeek/models/percolaterequest.py +0 -57
- mixpeek/models/permission.py +0 -10
- mixpeek/models/processimageurlinput.py +0 -99
- mixpeek/models/processtextinput.py +0 -94
- mixpeek/models/processvideourlinput.py +0 -99
- mixpeek/models/querysettings.py +0 -56
- mixpeek/models/rerankingoptions.py +0 -47
- mixpeek/models/search_assets_assets_search_postop.py +0 -59
- mixpeek/models/search_features_features_search_postop.py +0 -96
- mixpeek/models/search_model_searchquery_input.py +0 -76
- mixpeek/models/searchassetsrequest.py +0 -78
- mixpeek/models/searchinteraction.py +0 -82
- mixpeek/models/searchquery_output.py +0 -79
- mixpeek/models/searchrequestfeatures_input.py +0 -151
- mixpeek/models/searchrequestfeatures_output.py +0 -151
- mixpeek/models/sortoption.py +0 -28
- mixpeek/models/sparseembedding.py +0 -21
- mixpeek/models/tasks_model_taskresponse.py +0 -24
- mixpeek/models/taskstatus.py +0 -16
- mixpeek/models/textindexparams.py +0 -31
- mixpeek/models/textsettings.py +0 -61
- mixpeek/models/tokenizertype.py +0 -11
- mixpeek/models/update_api_key_organizations_users_user_email_api_keys_key_name_patchop.py +0 -30
- mixpeek/models/update_collection_collections_collection_putop.py +0 -74
- mixpeek/models/update_namespace_namespaces_namespace_putop.py +0 -28
- mixpeek/models/updateassetrequest.py +0 -60
- mixpeek/models/updatenamespacerequest.py +0 -26
- mixpeek/models/usage.py +0 -18
- mixpeek/models/usermodel_input.py +0 -36
- mixpeek/models/usermodel_output.py +0 -36
- mixpeek/models/uuidindexparams.py +0 -21
- mixpeek/models/validationerror.py +0 -26
- mixpeek/models/vectormodel.py +0 -11
- mixpeek/models/vectortype.py +0 -9
- mixpeek/models/videodescribesettings.py +0 -82
- mixpeek/models/videodetectsettings.py +0 -53
- mixpeek/models/videoreadsettings.py +0 -71
- mixpeek/models/videosettings.py +0 -101
- mixpeek/models/videotranscriptionsettings.py +0 -69
- mixpeek/namespaces.py +0 -1143
- mixpeek/organizations.py +0 -1508
- mixpeek/py.typed +0 -1
- mixpeek/sdk.py +0 -135
- mixpeek/sdkconfiguration.py +0 -45
- mixpeek/searchinteractions.py +0 -647
- mixpeek/tasks.py +0 -387
- mixpeek/types/__init__.py +0 -21
- mixpeek/types/basemodel.py +0 -39
- mixpeek/utils/__init__.py +0 -97
- mixpeek/utils/annotations.py +0 -55
- mixpeek/utils/enums.py +0 -34
- mixpeek/utils/eventstreaming.py +0 -238
- mixpeek/utils/forms.py +0 -202
- mixpeek/utils/headers.py +0 -136
- mixpeek/utils/logger.py +0 -27
- mixpeek/utils/metadata.py +0 -118
- mixpeek/utils/queryparams.py +0 -205
- mixpeek/utils/requestbodies.py +0 -66
- mixpeek/utils/retries.py +0 -217
- mixpeek/utils/security.py +0 -174
- mixpeek/utils/serializers.py +0 -215
- mixpeek/utils/url.py +0 -155
- mixpeek/utils/values.py +0 -134
- mixpeek-0.1.2.dist-info/METADATA +0 -439
- mixpeek-0.1.2.dist-info/RECORD +0 -176
- py.typed +0 -1
mixpeek/__init__.py
CHANGED
@@ -1,9 +1,73 @@
|
|
1
|
-
|
1
|
+
# mixpeek.py
|
2
|
+
import requests
|
3
|
+
import json
|
2
4
|
|
3
|
-
from ._version import __title__, __version__
|
4
|
-
from .sdk import *
|
5
|
-
from .sdkconfiguration import *
|
6
|
-
from .models import *
|
7
5
|
|
6
|
+
class Mixpeek:
|
7
|
+
def __init__(self, api_key):
|
8
|
+
self.base_url = "https://api.mixpeek.com"
|
9
|
+
self.headers = {
|
10
|
+
"Authorization": f"Bearer {api_key}",
|
11
|
+
"Content-Type": "application/json",
|
12
|
+
}
|
13
|
+
self.generate = self.Generate(self)
|
14
|
+
self.parse = self.Parse(self)
|
8
15
|
|
9
|
-
|
16
|
+
def _send_post(self, url, payload):
|
17
|
+
return requests.post(url, headers=self.headers, data=json.dumps(payload)).json()
|
18
|
+
|
19
|
+
def _send_get(self, url):
|
20
|
+
return requests.get(url, headers=self.headers).json()
|
21
|
+
|
22
|
+
class Generate:
|
23
|
+
def __init__(self, mixpeek):
|
24
|
+
self.mixpeek = mixpeek
|
25
|
+
self.openai = self.OpenAI(self.mixpeek)
|
26
|
+
|
27
|
+
class OpenAI:
|
28
|
+
def __init__(self, mixpeek):
|
29
|
+
self.mixpeek = mixpeek
|
30
|
+
self.generate_openai_url = f"{self.mixpeek.base_url}/generate"
|
31
|
+
|
32
|
+
def _construct_request_format(
|
33
|
+
self, model, context, response_format, settings=None
|
34
|
+
):
|
35
|
+
payload = {
|
36
|
+
"model": {"provider": "gpt", "model": model},
|
37
|
+
"context": context,
|
38
|
+
"messages": [{"role": "user", "content": ""}],
|
39
|
+
**settings,
|
40
|
+
}
|
41
|
+
|
42
|
+
if response_format is not None:
|
43
|
+
json_schema = response_format.model_json_schema()
|
44
|
+
payload["response_format"] = json_schema
|
45
|
+
|
46
|
+
return payload
|
47
|
+
|
48
|
+
def chat(self, model, response_format, context, settings=None):
|
49
|
+
payload = self._construct_request_format(
|
50
|
+
model, context, response_format, settings
|
51
|
+
)
|
52
|
+
return self.mixpeek._send_post(self.generate_openai_url, payload)
|
53
|
+
|
54
|
+
class Parse:
|
55
|
+
def __init__(self, mixpeek):
|
56
|
+
self.mixpeek = mixpeek
|
57
|
+
self.text = self.Text(self.mixpeek)
|
58
|
+
|
59
|
+
class Text:
|
60
|
+
def __init__(self, mixpeek):
|
61
|
+
self.mixpeek = mixpeek
|
62
|
+
self.parse_url = f"{self.mixpeek.base_url}/parsers"
|
63
|
+
|
64
|
+
def extract(self, file_url, should_chunk=True):
|
65
|
+
url = self.parse_url + "?should_chunk=" + str(should_chunk)
|
66
|
+
return self.mixpeek._send_post(url, {"file_url": file_url})
|
67
|
+
|
68
|
+
def chunk(self, corpus):
|
69
|
+
pass
|
70
|
+
|
71
|
+
class Index:
|
72
|
+
def __init__(self):
|
73
|
+
pass
|
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
Copyright (c) 2021 mixpeek
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
12
|
+
copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
18
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
19
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
20
|
+
OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: mixpeek
|
3
|
+
Version: 0.3
|
4
|
+
Summary: full-text file search API
|
5
|
+
Home-page: https://github.com/mixpeek/mixpeek-python
|
6
|
+
Author: Ethan Steininger
|
7
|
+
Author-email: info@mixpeek.com
|
8
|
+
License: MIT
|
9
|
+
Keywords: file search
|
10
|
+
License-File: LICENSE.rst
|
11
|
+
Requires-Dist: requests
|
12
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
mixpeek/__init__.py,sha256=4e_lxuzNX6tRmpdleC0BP2PCuDrQeIomlQjbmR4NUK4,2448
|
2
|
+
mixpeek-0.3.dist-info/LICENSE.rst,sha256=HHFCinDHL38osjHNrBgNZqExYuEWJ3hNZxzcr1mWWeo,1072
|
3
|
+
mixpeek-0.3.dist-info/METADATA,sha256=KrH4YrR4lxQ6o4iXR6SXLYIScyynne78s45e3DXLWvc,279
|
4
|
+
mixpeek-0.3.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
|
5
|
+
mixpeek-0.3.dist-info/top_level.txt,sha256=EJ8Jc4IhqyUwnUlBwKbs498Ju4O9a-IDh2kXc_lo6Vg,8
|
6
|
+
mixpeek-0.3.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
mixpeek
|
mixpeek/_hooks/__init__.py
DELETED
mixpeek/_hooks/registration.py
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
from .types import Hooks
|
2
|
-
|
3
|
-
|
4
|
-
# This file is only ever generated once on the first generation and then is free to be modified.
|
5
|
-
# Any hooks you wish to add should be registered in the init_hooks function. Feel free to define them
|
6
|
-
# in this file or in separate files in the hooks folder.
|
7
|
-
|
8
|
-
|
9
|
-
def init_hooks(hooks: Hooks):
|
10
|
-
# pylint: disable=unused-argument
|
11
|
-
"""Add hooks by calling hooks.register{sdk_init/before_request/after_success/after_error}Hook
|
12
|
-
with an instance of a hook that implements that specific Hook interface
|
13
|
-
Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance"""
|
mixpeek/_hooks/sdkhooks.py
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
|
-
|
3
|
-
import httpx
|
4
|
-
from .types import (
|
5
|
-
SDKInitHook,
|
6
|
-
BeforeRequestContext,
|
7
|
-
BeforeRequestHook,
|
8
|
-
AfterSuccessContext,
|
9
|
-
AfterSuccessHook,
|
10
|
-
AfterErrorContext,
|
11
|
-
AfterErrorHook,
|
12
|
-
Hooks,
|
13
|
-
)
|
14
|
-
from .registration import init_hooks
|
15
|
-
from typing import List, Optional, Tuple
|
16
|
-
from mixpeek.httpclient import HttpClient
|
17
|
-
|
18
|
-
|
19
|
-
class SDKHooks(Hooks):
|
20
|
-
def __init__(self) -> None:
|
21
|
-
self.sdk_init_hooks: List[SDKInitHook] = []
|
22
|
-
self.before_request_hooks: List[BeforeRequestHook] = []
|
23
|
-
self.after_success_hooks: List[AfterSuccessHook] = []
|
24
|
-
self.after_error_hooks: List[AfterErrorHook] = []
|
25
|
-
init_hooks(self)
|
26
|
-
|
27
|
-
def register_sdk_init_hook(self, hook: SDKInitHook) -> None:
|
28
|
-
self.sdk_init_hooks.append(hook)
|
29
|
-
|
30
|
-
def register_before_request_hook(self, hook: BeforeRequestHook) -> None:
|
31
|
-
self.before_request_hooks.append(hook)
|
32
|
-
|
33
|
-
def register_after_success_hook(self, hook: AfterSuccessHook) -> None:
|
34
|
-
self.after_success_hooks.append(hook)
|
35
|
-
|
36
|
-
def register_after_error_hook(self, hook: AfterErrorHook) -> None:
|
37
|
-
self.after_error_hooks.append(hook)
|
38
|
-
|
39
|
-
def sdk_init(self, base_url: str, client: HttpClient) -> Tuple[str, HttpClient]:
|
40
|
-
for hook in self.sdk_init_hooks:
|
41
|
-
base_url, client = hook.sdk_init(base_url, client)
|
42
|
-
return base_url, client
|
43
|
-
|
44
|
-
def before_request(
|
45
|
-
self, hook_ctx: BeforeRequestContext, request: httpx.Request
|
46
|
-
) -> httpx.Request:
|
47
|
-
for hook in self.before_request_hooks:
|
48
|
-
out = hook.before_request(hook_ctx, request)
|
49
|
-
if isinstance(out, Exception):
|
50
|
-
raise out
|
51
|
-
request = out
|
52
|
-
|
53
|
-
return request
|
54
|
-
|
55
|
-
def after_success(
|
56
|
-
self, hook_ctx: AfterSuccessContext, response: httpx.Response
|
57
|
-
) -> httpx.Response:
|
58
|
-
for hook in self.after_success_hooks:
|
59
|
-
out = hook.after_success(hook_ctx, response)
|
60
|
-
if isinstance(out, Exception):
|
61
|
-
raise out
|
62
|
-
response = out
|
63
|
-
return response
|
64
|
-
|
65
|
-
def after_error(
|
66
|
-
self,
|
67
|
-
hook_ctx: AfterErrorContext,
|
68
|
-
response: Optional[httpx.Response],
|
69
|
-
error: Optional[Exception],
|
70
|
-
) -> Tuple[Optional[httpx.Response], Optional[Exception]]:
|
71
|
-
for hook in self.after_error_hooks:
|
72
|
-
result = hook.after_error(hook_ctx, response, error)
|
73
|
-
if isinstance(result, Exception):
|
74
|
-
raise result
|
75
|
-
response, error = result
|
76
|
-
return response, error
|
mixpeek/_hooks/types.py
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
|
-
|
3
|
-
from abc import ABC, abstractmethod
|
4
|
-
import httpx
|
5
|
-
from mixpeek.httpclient import HttpClient
|
6
|
-
from typing import Any, Callable, List, Optional, Tuple, Union
|
7
|
-
|
8
|
-
|
9
|
-
class HookContext:
|
10
|
-
operation_id: str
|
11
|
-
oauth2_scopes: Optional[List[str]] = None
|
12
|
-
security_source: Optional[Union[Any, Callable[[], Any]]] = None
|
13
|
-
|
14
|
-
def __init__(
|
15
|
-
self,
|
16
|
-
operation_id: str,
|
17
|
-
oauth2_scopes: Optional[List[str]],
|
18
|
-
security_source: Optional[Union[Any, Callable[[], Any]]],
|
19
|
-
):
|
20
|
-
self.operation_id = operation_id
|
21
|
-
self.oauth2_scopes = oauth2_scopes
|
22
|
-
self.security_source = security_source
|
23
|
-
|
24
|
-
|
25
|
-
class BeforeRequestContext(HookContext):
|
26
|
-
def __init__(self, hook_ctx: HookContext):
|
27
|
-
super().__init__(
|
28
|
-
hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source
|
29
|
-
)
|
30
|
-
|
31
|
-
|
32
|
-
class AfterSuccessContext(HookContext):
|
33
|
-
def __init__(self, hook_ctx: HookContext):
|
34
|
-
super().__init__(
|
35
|
-
hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source
|
36
|
-
)
|
37
|
-
|
38
|
-
|
39
|
-
class AfterErrorContext(HookContext):
|
40
|
-
def __init__(self, hook_ctx: HookContext):
|
41
|
-
super().__init__(
|
42
|
-
hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source
|
43
|
-
)
|
44
|
-
|
45
|
-
|
46
|
-
class SDKInitHook(ABC):
|
47
|
-
@abstractmethod
|
48
|
-
def sdk_init(self, base_url: str, client: HttpClient) -> Tuple[str, HttpClient]:
|
49
|
-
pass
|
50
|
-
|
51
|
-
|
52
|
-
class BeforeRequestHook(ABC):
|
53
|
-
@abstractmethod
|
54
|
-
def before_request(
|
55
|
-
self, hook_ctx: BeforeRequestContext, request: httpx.Request
|
56
|
-
) -> Union[httpx.Request, Exception]:
|
57
|
-
pass
|
58
|
-
|
59
|
-
|
60
|
-
class AfterSuccessHook(ABC):
|
61
|
-
@abstractmethod
|
62
|
-
def after_success(
|
63
|
-
self, hook_ctx: AfterSuccessContext, response: httpx.Response
|
64
|
-
) -> Union[httpx.Response, Exception]:
|
65
|
-
pass
|
66
|
-
|
67
|
-
|
68
|
-
class AfterErrorHook(ABC):
|
69
|
-
@abstractmethod
|
70
|
-
def after_error(
|
71
|
-
self,
|
72
|
-
hook_ctx: AfterErrorContext,
|
73
|
-
response: Optional[httpx.Response],
|
74
|
-
error: Optional[Exception],
|
75
|
-
) -> Union[Tuple[Optional[httpx.Response], Optional[Exception]], Exception]:
|
76
|
-
pass
|
77
|
-
|
78
|
-
|
79
|
-
class Hooks(ABC):
|
80
|
-
@abstractmethod
|
81
|
-
def register_sdk_init_hook(self, hook: SDKInitHook):
|
82
|
-
pass
|
83
|
-
|
84
|
-
@abstractmethod
|
85
|
-
def register_before_request_hook(self, hook: BeforeRequestHook):
|
86
|
-
pass
|
87
|
-
|
88
|
-
@abstractmethod
|
89
|
-
def register_after_success_hook(self, hook: AfterSuccessHook):
|
90
|
-
pass
|
91
|
-
|
92
|
-
@abstractmethod
|
93
|
-
def register_after_error_hook(self, hook: AfterErrorHook):
|
94
|
-
pass
|
mixpeek/_version.py
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
|
-
|
3
|
-
import importlib.metadata
|
4
|
-
|
5
|
-
__title__: str = "mixpeek"
|
6
|
-
__version__: str = "0.1.2"
|
7
|
-
|
8
|
-
try:
|
9
|
-
if __package__ is not None:
|
10
|
-
__version__ = importlib.metadata.version(__package__)
|
11
|
-
except importlib.metadata.PackageNotFoundError:
|
12
|
-
pass
|