metaso-sdk 0.1.5__py3-none-any.whl → 0.1.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.
metaso_sdk/bookshelf.py CHANGED
@@ -15,6 +15,7 @@ def upload_book(fileobj_or_url) -> Optional[Book]:
15
15
  else:
16
16
  params = {"files": {"file": fileobj_or_url}}
17
17
  resp = client.put("/book", **params)
18
+ resp.raise_for_status()
18
19
  json = resp.json()
19
20
  status = Status.model_validate(json)
20
21
  if status.errCode == 0:
metaso_sdk/search.py CHANGED
@@ -32,4 +32,5 @@ def search(query: Query, *, stream: bool = False, topic: Topic = None):
32
32
  return _gen()
33
33
 
34
34
  resp = client.post("/search/v2", json=query.model_dump())
35
+ resp.raise_for_status()
35
36
  return resp.json()["data"]
metaso_sdk/subject.py CHANGED
@@ -14,6 +14,7 @@ def create_topic(topic: Topic) -> Optional[Topic]:
14
14
  :return: 专题对象。
15
15
  """
16
16
  resp = client.put("/topic", json=topic.model_dump())
17
+ resp.raise_for_status()
17
18
  json = resp.json()
18
19
  status = Status.model_validate(json)
19
20
  if status.errCode == 0:
@@ -28,6 +29,7 @@ def delete_topic(topic: Topic) -> bool:
28
29
  :return: 如果成功删除Topic返回True,否则返回False。
29
30
  """
30
31
  resp = client.post("/topic/trash", json={"ids": [topic.id]})
32
+ resp.raise_for_status()
31
33
  status = Status.model_validate(resp.json())
32
34
  return status.errCode == 0
33
35
 
@@ -40,6 +42,7 @@ def upload_file(topic: Topic, file) -> Optional[File]:
40
42
  :return: 如果文件上传成功,返回文件对象;否则返回None。
41
43
  """
42
44
  resp = client.put(f"/file/{topic.dirRootId}", files={"file": file})
45
+ resp.raise_for_status()
43
46
  json = resp.json()
44
47
  status = Status.model_validate(json)
45
48
  if status.errCode == 0:
@@ -55,6 +58,7 @@ def update_progress(file_or_book: Union[File, Book]) -> Union[File, Book]:
55
58
  """
56
59
  file_id = file_or_book.id if isinstance(file_or_book, File) else file_or_book.fileId
57
60
  resp = client.get(f"/file/{file_id}/progress")
61
+ resp.raise_for_status()
58
62
  json = resp.json()
59
63
  status = Status.model_validate(json)
60
64
  if status.errCode == 0:
@@ -70,6 +74,7 @@ def delete_file(file_or_book: Union[File, Book]) -> bool:
70
74
  """
71
75
  file_id = file_or_book.id if isinstance(file_or_book, File) else file_or_book.fileId
72
76
  resp = client.post("/file/trash", json={"ids": [file_id]})
77
+ resp.raise_for_status()
73
78
  status = Status.model_validate(resp.json())
74
79
  return status.errCode == 0
75
80
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: metaso-sdk
3
- Version: 0.1.5
3
+ Version: 0.1.6
4
4
  Summary: The official Python SDK for https://metaso.cn
5
5
  Author-Email: Zhao Xiaohong <zhaoxiaohong@metasota.ai>
6
6
  License: MIT
@@ -1,15 +1,15 @@
1
- metaso_sdk-0.1.5.dist-info/METADATA,sha256=6BF-8neJSO5jWgGmGlB4qj4ZjzXaAaFyecqsit-p734,3270
2
- metaso_sdk-0.1.5.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
- metaso_sdk-0.1.5.dist-info/entry_points.txt,sha256=VqvzYeWOYZKCpogIumetYL8h5UZsI93oLI15kJjbwj4,63
4
- metaso_sdk-0.1.5.dist-info/licenses/LICENSE,sha256=7nWd1jm_pniRaOJtzgZnzECn_eeGLoPMvPTjCyRpj1A,1065
1
+ metaso_sdk-0.1.6.dist-info/METADATA,sha256=hC_yNcOnjofg2HJ7to-ePGlmDht6TpabzFetAvrMBHc,3270
2
+ metaso_sdk-0.1.6.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
+ metaso_sdk-0.1.6.dist-info/entry_points.txt,sha256=VqvzYeWOYZKCpogIumetYL8h5UZsI93oLI15kJjbwj4,63
4
+ metaso_sdk-0.1.6.dist-info/licenses/LICENSE,sha256=7nWd1jm_pniRaOJtzgZnzECn_eeGLoPMvPTjCyRpj1A,1065
5
5
  metaso_sdk/__init__.py,sha256=ZXHdIXVXKtjC1QgE6v7AYBXAkOgzOivIzwcVRCEvvvM,582
6
6
  metaso_sdk/__main__.py,sha256=WCRS7Ehbf26-NWDSnt-Zmy0eP63paf67q9eYV4V_Q3g,345
7
- metaso_sdk/bookshelf.py,sha256=_PtTZ54tjfjWzCkzPifWhyGRwEUFOGDGIR3acnix9a8,693
7
+ metaso_sdk/bookshelf.py,sha256=wkcSR5NQFweYslT-c1fSjPerfgsCi--Jd0vWVgBKpgI,721
8
8
  metaso_sdk/cli.py,sha256=Z7I54ojBpWxQ_Pce7-XM7gucneDIpC21yAqRGkYrm9I,1734
9
9
  metaso_sdk/client.py,sha256=j2hC1NBbxsRFHC4hOSD06YrfV5JLffgrA-H5iGNBPq4,204
10
10
  metaso_sdk/debug.py,sha256=K3ypLgs78a8bhiAHE_5fZZAL-U622fuKPyEdL7M1UW8,2831
11
11
  metaso_sdk/model.py,sha256=_2cSadnrM-YV03e67f8wlLoAbMF3jfIsMvgNqDA5zzg,935
12
12
  metaso_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- metaso_sdk/search.py,sha256=3iA9lIncpAcbPHPby0XnTYaYvhM2983bEOBa40Nu_kY,1082
14
- metaso_sdk/subject.py,sha256=FfiFOoNqunQd4nHG84zYGWJd10xZeljL5iQiFC8UshY,3255
15
- metaso_sdk-0.1.5.dist-info/RECORD,,
13
+ metaso_sdk/search.py,sha256=gdruxkw7_MAwjMICv4b8Xvqr5Q3P4_BFSydd756vfKw,1110
14
+ metaso_sdk/subject.py,sha256=07jvVeU3kTMPZ1odnAzmzw8DVIT6idZoIIthVR5E4cg,3395
15
+ metaso_sdk-0.1.6.dist-info/RECORD,,