most-client 1.0.4__py3-none-any.whl → 1.0.6__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:
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:
most/types.py CHANGED
@@ -25,15 +25,6 @@ class ColumnResult(DataClassJsonMixin):
25
25
  subcolumns: List[SubcolumnResult]
26
26
 
27
27
 
28
- @dataclass_json
29
- @dataclass
30
- class Result(DataClassJsonMixin):
31
- id: str
32
- text: Optional[str]
33
- url: Optional[str]
34
- results: Optional[List[ColumnResult]]
35
-
36
-
37
28
  @dataclass_json
38
29
  @dataclass
39
30
  class Column(DataClassJsonMixin):
@@ -51,3 +42,21 @@ class Script(DataClassJsonMixin):
51
42
  @dataclass
52
43
  class JobStatus(DataClassJsonMixin):
53
44
  status: Literal["not_found", "pending", "completed", "error"]
45
+
46
+
47
+ @dataclass_json
48
+ @dataclass
49
+ class Result(DataClassJsonMixin):
50
+ id: str
51
+ text: Optional[str]
52
+ url: Optional[str]
53
+ results: Optional[List[ColumnResult]]
54
+
55
+ def get_script(self) -> Optional[Script]:
56
+ if self.results is None:
57
+ return None
58
+
59
+ return Script(columns=[Column(name=column_result.name,
60
+ subcolumns=[subcolumn_result.name
61
+ for subcolumn_result in column_result.subcolumns])
62
+ for column_result in self.results])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: most-client
3
- Version: 1.0.4
3
+ Version: 1.0.6
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=xtKsXbO40AgLIgTf-YndJnT2yfTlCl-p-j3M1CMBB8k,1377
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.6.dist-info/METADATA,sha256=SLqGtvyjFNtkSOw3o7RNVS9Ur0fy5HRzz_8gGN_85Bs,864
10
+ most_client-1.0.6.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
11
+ most_client-1.0.6.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
12
+ most_client-1.0.6.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
13
+ most_client-1.0.6.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- most/__init__.py,sha256=62uFFeM_1VVR83K3bTYWK3PEoqnmFCy9aWYerQ6U4Ds,67
2
- most/api.py,sha256=8lhnJU89qMiCjYgc5Gv4Z2i782ltBA7oTtnR57WyjK8,7285
3
- most/async_api.py,sha256=tHo-vVa3a1LVCZ7c-Zwp5fmMx88AoZ3c-84VpLtlNFc,7946
4
- most/types.py,sha256=phMLar9VTZIVeHLBLHYsEBiTvz8af-GHHF1GLctGytE,969
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.4.dist-info/METADATA,sha256=eijnCdZFCVPNdMYgEZirZYedoNzPRJiku6Hcf8_Gvjo,864
10
- most_client-1.0.4.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
11
- most_client-1.0.4.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
12
- most_client-1.0.4.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
13
- most_client-1.0.4.dist-info/RECORD,,