most-client 1.0.3__py3-none-any.whl → 1.0.5__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.
Binary file
Binary file
Binary file
Binary file
most/api.py CHANGED
@@ -89,6 +89,8 @@ class MostClient(object):
89
89
  return self.get(url,
90
90
  headers=headers,
91
91
  **kwargs)
92
+ if resp.status_code >= 400:
93
+ raise RuntimeError(resp.json()['message'] if resp.headers.get("Content-Type") == "application/json" else "Something went wrong.")
92
94
  return resp
93
95
 
94
96
  def post(self, url,
@@ -111,6 +113,8 @@ class MostClient(object):
111
113
  json=json,
112
114
  headers=headers,
113
115
  **kwargs)
116
+ if resp.status_code >= 400:
117
+ raise RuntimeError(resp.json()['message'] if resp.headers.get("Content-Type") == "application/json" else "Something went wrong.")
114
118
  return resp
115
119
 
116
120
  def upload_audio(self, audio_path) -> Audio:
@@ -119,6 +123,11 @@ class MostClient(object):
119
123
  files={"audio_file": f})
120
124
  return self.retort.load(resp.json(), Audio)
121
125
 
126
+ def upload_audio_url(self, audio_url) -> Audio:
127
+ resp = self.post(f"https://api.the-most.ai/api/external/{self.client_id}/upload_url",
128
+ json={"audio_url": audio_url})
129
+ return self.retort.load(resp.json(), Audio)
130
+
122
131
  def list_audios(self,
123
132
  offset: int = 0,
124
133
  limit: int = 10) -> List[Audio]:
most/async_api.py CHANGED
@@ -95,6 +95,9 @@ class AsyncMostClient(object):
95
95
  return await self.get(url,
96
96
  headers=headers,
97
97
  **kwargs)
98
+ if resp.status_code >= 400:
99
+ raise RuntimeError(resp.json()['message'] if resp.headers.get(
100
+ "Content-Type") == "application/json" else "Something went wrong.")
98
101
  return resp
99
102
 
100
103
  async def post(self, url,
@@ -117,6 +120,9 @@ class AsyncMostClient(object):
117
120
  json=json,
118
121
  headers=headers,
119
122
  **kwargs)
123
+ if resp.status_code >= 400:
124
+ raise RuntimeError(resp.json()['message'] if resp.headers.get(
125
+ "Content-Type") == "application/json" else "Something went wrong.")
120
126
  return resp
121
127
 
122
128
  async def upload_audio(self, audio_path) -> Audio:
@@ -126,6 +132,11 @@ class AsyncMostClient(object):
126
132
  timeout=None)
127
133
  return self.retort.load(resp.json(), Audio)
128
134
 
135
+ async def upload_audio_url(self, audio_url) -> Audio:
136
+ resp = await self.post(f"https://api.the-most.ai/api/external/{self.client_id}/upload_url",
137
+ json={"audio_url": audio_url})
138
+ return self.retort.load(resp.json(), Audio)
139
+
129
140
  async def list_audios(self,
130
141
  offset: int = 0,
131
142
  limit: int = 10) -> List[Audio]:
most/types.py CHANGED
@@ -1,45 +1,53 @@
1
1
  from dataclasses import dataclass
2
+ from dataclasses_json import dataclass_json, DataClassJsonMixin
2
3
  from typing import Optional, List, Literal
3
4
 
4
5
 
6
+ @dataclass_json
5
7
  @dataclass
6
- class Audio:
8
+ class Audio(DataClassJsonMixin):
7
9
  id: str
8
10
  url: str
9
11
 
10
12
 
13
+ @dataclass_json
11
14
  @dataclass
12
- class SubcolumnResult:
15
+ class SubcolumnResult(DataClassJsonMixin):
13
16
  name: str
14
17
  score: Optional[int]
15
18
  description: str
16
19
 
17
20
 
21
+ @dataclass_json
18
22
  @dataclass
19
- class ColumnResult:
23
+ class ColumnResult(DataClassJsonMixin):
20
24
  name: str
21
25
  subcolumns: List[SubcolumnResult]
22
26
 
23
27
 
28
+ @dataclass_json
24
29
  @dataclass
25
- class Result:
30
+ class Result(DataClassJsonMixin):
26
31
  id: str
27
32
  text: Optional[str]
28
33
  url: Optional[str]
29
34
  results: Optional[List[ColumnResult]]
30
35
 
31
36
 
37
+ @dataclass_json
32
38
  @dataclass
33
- class Column:
39
+ class Column(DataClassJsonMixin):
34
40
  name: str
35
41
  subcolumns: List[str]
36
42
 
37
43
 
44
+ @dataclass_json
38
45
  @dataclass
39
- class Script:
46
+ class Script(DataClassJsonMixin):
40
47
  columns: List[Column]
41
48
 
42
49
 
50
+ @dataclass_json
43
51
  @dataclass
44
- class JobStatus:
52
+ class JobStatus(DataClassJsonMixin):
45
53
  status: Literal["not_found", "pending", "completed", "error"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: most-client
3
- Version: 1.0.3
3
+ Version: 1.0.5
4
4
  Summary: Most AI API for https://the-most.ai
5
5
  Home-page: https://github.com/the-most-ai/most-client
6
6
  Author: George Kasparyants
@@ -0,0 +1,13 @@
1
+ most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
2
+ most/api.py,sha256=35SmN9BhZRUQZMH400MYh0LAHgYK8d_25at5BaBihIw,7641
3
+ most/async_api.py,sha256=QTQ2RdLeI2GzB6EvlrRnpoqs9XBOR64drVTpulvGrFI,8336
4
+ most/types.py,sha256=phMLar9VTZIVeHLBLHYsEBiTvz8af-GHHF1GLctGytE,969
5
+ most/__pycache__/__init__.cpython-310.pyc,sha256=uRCbA8tXEFLxmAlpQAF8Vdh8AZbpR52RSrGOfKRxpAQ,229
6
+ most/__pycache__/api.cpython-310.pyc,sha256=YuMpKt9DwpvUgXH2qPKMVbJxwgkTLrp9wso73MA3jkM,6582
7
+ most/__pycache__/async_api.cpython-310.pyc,sha256=d4RQJ-yhe9rbMjjU_7IyeK0lRB7WalIdXpXRxz-Db4A,7328
8
+ most/__pycache__/types.cpython-310.pyc,sha256=B3tij9LD4YJAXWiC3VHtnkVzpw5QRirrHpDMD-vekII,1861
9
+ most_client-1.0.5.dist-info/METADATA,sha256=pjYtjnQ3zfCpVEqgMCQv1Ed_t371Uwfdw1x8lmG-nHE,864
10
+ most_client-1.0.5.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
11
+ most_client-1.0.5.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
12
+ most_client-1.0.5.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
13
+ most_client-1.0.5.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
2
- most/api.py,sha256=3B0G6qZUbAJtTKpQme0SdI2JnCsT-_fRDDWBZKKtmvA,7030
3
- most/async_api.py,sha256=aepk9EXOv-tLVh8bNrACuTVkxGOtCZC5R3SBLi9qR90,7673
4
- most/types.py,sha256=GP0i9ZtITz7k-_T5-SWMYevrRaN38vuNKRdxXEHgrFA,653
5
- most/__pycache__/__init__.cpython-310.pyc,sha256=5RlgyJsgWSNkWEufVPFWDKxat0cEMCdwD8QFz5FvIj8,193
6
- most/__pycache__/api.cpython-310.pyc,sha256=vAmUcfJHdL-59JuzcMpDfQedBaTk62nomDuzTt-thx0,5894
7
- most/__pycache__/async_api.cpython-310.pyc,sha256=ng8wYkVziihVAMlv1ugFQQf-qFqP0NgAIfqKqE-K4k8,6615
8
- most/__pycache__/types.cpython-310.pyc,sha256=OE7jIlp_0lo6XAwsnVnbsYsjjppGzTUcVo5ve6uHnQg,1492
9
- most_client-1.0.3.dist-info/METADATA,sha256=msB8Kt-Cpr8u6FlMWtk0n2_jC3GwrHO4TXXEv1mbDgU,864
10
- most_client-1.0.3.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
11
- most_client-1.0.3.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
12
- most_client-1.0.3.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
13
- most_client-1.0.3.dist-info/RECORD,,