most-client 1.0.23__py3-none-any.whl → 1.0.24__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.
- most/api.py +29 -0
- most/async_api.py +29 -0
- {most_client-1.0.23.dist-info → most_client-1.0.24.dist-info}/METADATA +1 -1
- most_client-1.0.24.dist-info/RECORD +10 -0
- most_client-1.0.23.dist-info/RECORD +0 -10
- {most_client-1.0.23.dist-info → most_client-1.0.24.dist-info}/WHEEL +0 -0
- {most_client-1.0.23.dist-info → most_client-1.0.24.dist-info}/top_level.txt +0 -0
- {most_client-1.0.23.dist-info → most_client-1.0.24.dist-info}/zip-safe +0 -0
most/api.py
CHANGED
@@ -114,6 +114,24 @@ class MostClient(object):
|
|
114
114
|
raise RuntimeError(resp.json()['message'] if resp.headers.get("Content-Type") == "application/json" else "Something went wrong.")
|
115
115
|
return resp
|
116
116
|
|
117
|
+
def put(self, url, **kwargs):
|
118
|
+
if self.access_token is None:
|
119
|
+
self.refresh_access_token()
|
120
|
+
headers = kwargs.pop("headers", {})
|
121
|
+
headers.update({"Authorization": "Bearer %s" % self.access_token})
|
122
|
+
resp = self.session.put(url,
|
123
|
+
headers=headers,
|
124
|
+
timeout=None,
|
125
|
+
**kwargs)
|
126
|
+
if resp.status_code == 401:
|
127
|
+
self.refresh_access_token()
|
128
|
+
return self.put(url,
|
129
|
+
headers=headers,
|
130
|
+
**kwargs)
|
131
|
+
if resp.status_code >= 400:
|
132
|
+
raise RuntimeError(resp.json()['message'] if resp.headers.get("Content-Type") == "application/json" else "Something went wrong.")
|
133
|
+
return resp
|
134
|
+
|
117
135
|
def post(self, url,
|
118
136
|
data=None,
|
119
137
|
json=None,
|
@@ -307,6 +325,17 @@ class MostClient(object):
|
|
307
325
|
resp = self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/dialog")
|
308
326
|
return self.retort.load(resp.json(), DialogResult)
|
309
327
|
|
328
|
+
def update_dialog(self, audio_id, dialog: Dialog) -> DialogResult:
|
329
|
+
if not is_valid_id(self.model_id):
|
330
|
+
raise RuntimeError("Please choose valid model to apply. [try list_models()]")
|
331
|
+
|
332
|
+
if not is_valid_id(audio_id):
|
333
|
+
raise RuntimeError("Please use valid audio_id. [try audio.id from list_audios()]")
|
334
|
+
|
335
|
+
resp = self.put(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/dialog",
|
336
|
+
json={"dialog": dialog.to_dict()})
|
337
|
+
return self.retort.load(resp.json(), DialogResult)
|
338
|
+
|
310
339
|
def export(self, audio_ids: List[str],
|
311
340
|
aggregated_by: Optional[str] = None,
|
312
341
|
aggregation_title: Optional[str] = None) -> str:
|
most/async_api.py
CHANGED
@@ -122,6 +122,24 @@ class AsyncMostClient(object):
|
|
122
122
|
"Content-Type") == "application/json" else "Something went wrong.")
|
123
123
|
return resp
|
124
124
|
|
125
|
+
async def put(self, url, **kwargs):
|
126
|
+
if self.access_token is None:
|
127
|
+
await self.refresh_access_token()
|
128
|
+
headers = kwargs.pop("headers", {})
|
129
|
+
headers.update({"Authorization": "Bearer %s" % self.access_token})
|
130
|
+
resp = await self.session.put(url,
|
131
|
+
headers=headers,
|
132
|
+
timeout=None,
|
133
|
+
**kwargs)
|
134
|
+
if resp.status_code == 401:
|
135
|
+
await self.refresh_access_token()
|
136
|
+
return await self.put(url,
|
137
|
+
headers=headers,
|
138
|
+
**kwargs)
|
139
|
+
if resp.status_code >= 400:
|
140
|
+
raise RuntimeError(resp.json()['message'] if resp.headers.get("Content-Type") == "application/json" else "Something went wrong.")
|
141
|
+
return resp
|
142
|
+
|
125
143
|
async def post(self, url,
|
126
144
|
data=None,
|
127
145
|
json=None,
|
@@ -316,6 +334,17 @@ class AsyncMostClient(object):
|
|
316
334
|
resp = await self.get(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/dialog")
|
317
335
|
return self.retort.load(resp.json(), DialogResult)
|
318
336
|
|
337
|
+
async def update_dialog(self, audio_id, dialog: Dialog) -> DialogResult:
|
338
|
+
if not is_valid_id(self.model_id):
|
339
|
+
raise RuntimeError("Please choose valid model to apply. [try list_models()]")
|
340
|
+
|
341
|
+
if not is_valid_id(audio_id):
|
342
|
+
raise RuntimeError("Please use valid audio_id. [try audio.id from list_audios()]")
|
343
|
+
|
344
|
+
resp = await self.put(f"https://api.the-most.ai/api/external/{self.client_id}/audio/{audio_id}/model/{self.model_id}/dialog",
|
345
|
+
json={"dialog": dialog.to_dict()})
|
346
|
+
return self.retort.load(resp.json(), DialogResult)
|
347
|
+
|
319
348
|
async def export(self, audio_ids: List[str],
|
320
349
|
aggregated_by: Optional[str] = None,
|
321
350
|
aggregation_title: Optional[str] = None) -> str:
|
@@ -0,0 +1,10 @@
|
|
1
|
+
most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
|
2
|
+
most/api.py,sha256=HWSwJX1QFRCvhf5OkH3Fx8lvGjLt_6gM9H6D5aKZ1og,17638
|
3
|
+
most/async_api.py,sha256=w56Ll0r97I__PSqFxvCGO6GOCeno1qvOdAwgK5FhtlM,18703
|
4
|
+
most/score_calculation.py,sha256=1XU1LfIH5LSCwAbAaKkr-EjH5qOTXrJKOUvhCCawka4,1054
|
5
|
+
most/types.py,sha256=Qgyv261J8b1cfbmeITz1C9QgkoCMGQQd_L4t4M3dd6M,3603
|
6
|
+
most_client-1.0.24.dist-info/METADATA,sha256=63Geupu8DOnw5svjeWeOSBW1S5qPSZZ7ZbZLynNXs9k,1027
|
7
|
+
most_client-1.0.24.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
8
|
+
most_client-1.0.24.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
|
9
|
+
most_client-1.0.24.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
10
|
+
most_client-1.0.24.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
|
2
|
-
most/api.py,sha256=Fp9MeADwnjwf8_BYbleIKB0gFfsK3GNsNZDHRnqgOms,16256
|
3
|
-
most/async_api.py,sha256=7kFpsU6yCAeEjOroXL-t_m1RIOwLqmMyPq9tPhoUIjw,17243
|
4
|
-
most/score_calculation.py,sha256=1XU1LfIH5LSCwAbAaKkr-EjH5qOTXrJKOUvhCCawka4,1054
|
5
|
-
most/types.py,sha256=Qgyv261J8b1cfbmeITz1C9QgkoCMGQQd_L4t4M3dd6M,3603
|
6
|
-
most_client-1.0.23.dist-info/METADATA,sha256=pBQkXH2Ogl8Ot9SWv8gLnmB8r7j1t74eY3X6oCoC63M,1027
|
7
|
-
most_client-1.0.23.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
8
|
-
most_client-1.0.23.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
|
9
|
-
most_client-1.0.23.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
10
|
-
most_client-1.0.23.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|