meilisearch-python-sdk 7.2.1__py3-none-any.whl → 7.2.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.
@@ -103,7 +103,7 @@ class AsyncClient(BaseClient):
103
103
  async def __aexit__(
104
104
  self,
105
105
  et: type[BaseException] | None,
106
- ev: type[BaseException] | None,
106
+ ev: BaseException | None,
107
107
  traceback: TracebackType | None,
108
108
  ) -> None:
109
109
  await self.aclose()
@@ -105,7 +105,7 @@ class Client(BaseClient):
105
105
  def __exit__(
106
106
  self,
107
107
  et: type[BaseException] | None,
108
- ev: type[BaseException] | None,
108
+ ev: BaseException | None,
109
109
  traceback: TracebackType | None,
110
110
  ) -> None:
111
111
  self.close()
@@ -77,7 +77,7 @@ class AsyncHttpRequests:
77
77
  raise MeilisearchCommunicationError(str(err)) from err
78
78
  except HTTPError as err:
79
79
  if "response" in locals():
80
- if "application/json" in response.headers.get("content-type", ""):
80
+ if "application/json" in response.headers.get("content-type", ""): # pyrefly: ignore[unbound-name]
81
81
  raise MeilisearchApiError(str(err), response) from err
82
82
  else:
83
83
  raise
@@ -165,7 +165,7 @@ class HttpRequests:
165
165
  raise MeilisearchCommunicationError(str(err)) from err
166
166
  except HTTPError as err:
167
167
  if "response" in locals():
168
- if "application/json" in response.headers.get("content-type", ""):
168
+ if "application/json" in response.headers.get("content-type", ""): # pyrefly: ignore[unbound-name]
169
169
  raise MeilisearchApiError(str(err), response) from err
170
170
  else:
171
171
  raise
@@ -207,6 +207,7 @@ class HttpRequests:
207
207
  return self._send_request(self.http_client.delete, path, body)
208
208
 
209
209
 
210
+ @lru_cache(maxsize=4)
210
211
  def build_headers(content_type: str, compress: bool) -> dict[str, str]:
211
212
  headers = {"user-agent": user_agent(), "Content-Type": content_type}
212
213
 
@@ -1 +1 @@
1
- VERSION = "7.2.1"
1
+ VERSION = "7.2.3"
@@ -1,3 +1,5 @@
1
+ import json
2
+
1
3
  from httpx2 import Response
2
4
 
3
5
 
@@ -35,8 +37,13 @@ class MeilisearchApiError(MeilisearchError):
35
37
  self.message = ""
36
38
  self.link = ""
37
39
  self.error_type = ""
40
+ error_json = None
38
41
  if response.content:
39
- error_json = response.json()
42
+ try:
43
+ error_json = response.json()
44
+ except json.JSONDecodeError:
45
+ error_json = None
46
+ if isinstance(error_json, dict):
40
47
  self.message = f"Error message: {error_json.get('message') or ''}"
41
48
  self.code = f"{error_json.get('code') or ''}"
42
49
  self.error_type = f"{error_json.get('type') or ''}"
@@ -56,12 +56,12 @@ class OrjsonHandler(_JsonHandler):
56
56
 
57
57
  @staticmethod
58
58
  def dumps(obj: Any) -> str: # noqa: ANN401
59
- return orjson.dumps(obj).decode("utf-8")
59
+ return orjson.dumps(obj).decode("utf-8") # pyrefly: ignore[missing-attribute]
60
60
 
61
61
  @staticmethod
62
62
  def dump_bytes(obj: Any) -> bytes: # noqa: ANN401
63
- return orjson.dumps(obj)
63
+ return orjson.dumps(obj) # pyrefly: ignore[missing-attribute]
64
64
 
65
65
  @staticmethod
66
66
  def loads(json_string: str | bytes | bytearray) -> Any: # noqa: ANN401
67
- return orjson.loads(json_string)
67
+ return orjson.loads(json_string) # pyrefly: ignore[missing-attribute]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meilisearch-python-sdk
3
- Version: 7.2.1
3
+ Version: 7.2.3
4
4
  Summary: A Python client providing both async and sync support for the Meilisearch API
5
5
  Project-URL: repository, https://github.com/sanders41/meilisearch-python-sdk
6
6
  Project-URL: homepage, https://github.com/sanders41/meilisearch-python-sdk
@@ -1,19 +1,19 @@
1
1
  meilisearch_python_sdk/__init__.py,sha256=SB0Jlm6FwT13J9xasZKseZzTWBk0hkfe1CWyWmIIZnE,258
2
2
  meilisearch_python_sdk/_batch.py,sha256=PQyXyERVQwnxIFMthZ6zVqi2ZbQbMBs6TgUPdLbJLSY,5920
3
- meilisearch_python_sdk/_http_requests.py,sha256=0Txm751u9NLLe8N02WIVUaQS4YdBu5hSERKIyFSwESw,7764
3
+ meilisearch_python_sdk/_http_requests.py,sha256=81UPpbNIHsEUlaue5Cgn8WZ4M6byVcrzA7lAEkcd10I,7852
4
4
  meilisearch_python_sdk/_task.py,sha256=lQp2n5ZjD8HboEP6Xid0Z275Jcr4GuXwh_LzpVY5LAo,13189
5
5
  meilisearch_python_sdk/_utils.py,sha256=6Yy0tRe6V0kocVmaYb0rO2Hw2GmvEeY_XLY05P5bMq0,4317
6
- meilisearch_python_sdk/_version.py,sha256=9v7Fy-xFC6eIQHU0KLDkR-vBxDqkwrkfbgTBHRquH4Y,18
6
+ meilisearch_python_sdk/_version.py,sha256=FIS2MIPS0ff2pJkakLh3vmrrmpjt06LAIj0_Uzp8a_E,18
7
7
  meilisearch_python_sdk/decorators.py,sha256=wgznbwCYRc1_nVfQaOgj7DcOMejB9mJIWqltW6CimnY,8836
8
- meilisearch_python_sdk/errors.py,sha256=VZAcq_72l1y1YMe56FOnxpQ9gV3sk8_ceT7FiHs_wYI,3176
9
- meilisearch_python_sdk/json_handler.py,sha256=cBJ3LtK7SRIJKgEg6MJ4XTSFUrNnZ2vSiTKdrg-56pk,2007
8
+ meilisearch_python_sdk/errors.py,sha256=8cJpHJbJR7t6Tyt15yXVUpNYKbfWt2HTKiBCISDIBrA,3352
9
+ meilisearch_python_sdk/json_handler.py,sha256=lzwiBP4ASjdBiBLQAjp9akbL-9TnaWnu8Ayy380R_s0,2121
10
10
  meilisearch_python_sdk/plugins.py,sha256=ACk07_3ySHnz_clF3IiJRKeAlSGhpyQfn4taqAozIjo,3750
11
11
  meilisearch_python_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  meilisearch_python_sdk/types.py,sha256=nf-_ZjbPVGdVg-spkfFoaGebQvzmWqiDWuyBwR_qWJk,473
13
13
  meilisearch_python_sdk/_client/__init__.py,sha256=ld4FGQM5wt-Ygtt4z4UgZKL8dQ1jY98NY1Fst_-bhA4,164
14
- meilisearch_python_sdk/_client/_async_client.py,sha256=6PVZhROl9TrjieOTEnR2MG7Qlg_tWMKgKLITmmv9xjw,48828
14
+ meilisearch_python_sdk/_client/_async_client.py,sha256=OCIDZFx-UdlWcyCmt8FVpxOw0ZpIA-Z2i170ifNmk00,48822
15
15
  meilisearch_python_sdk/_client/_base_client.py,sha256=FfNigpAOibsjkzlMf2FOv68DRcVYp4D0Nii0RW3C-Tc,3992
16
- meilisearch_python_sdk/_client/_client.py,sha256=kyLIJfjWPAnXbJME5F522Aeo1qaxXYJxKreNBxpWafc,47319
16
+ meilisearch_python_sdk/_client/_client.py,sha256=hsOdiyery3I6ksOvoX2BQvz_LFojhoYQMKFp8t_fozc,47313
17
17
  meilisearch_python_sdk/_client/_common.py,sha256=7aMbLK5ZkuhA_I_2wUomgvVdGHVGF6DJgqfwzO7jnpw,3069
18
18
  meilisearch_python_sdk/index/__init__.py,sha256=sULiCF_Gqa66SDLuyvlHQ1NW-6ch5sWU6UNZ572sdEA,152
19
19
  meilisearch_python_sdk/index/_common.py,sha256=q6IqRpvmUIpOWuoa_XDuv_MsKB8XN1AQljgemN0Cha8,11009
@@ -30,7 +30,7 @@ meilisearch_python_sdk/models/settings.py,sha256=lc0YYnqpMF3szWuKWAiGMKJGmqHO6Hz
30
30
  meilisearch_python_sdk/models/task.py,sha256=nDD-S7K-uL4gcYU-tyPstBWcnJi_8MiDwc53GG6i304,1105
31
31
  meilisearch_python_sdk/models/version.py,sha256=ISU-ZHgpXLBFDuMpWWfKdVo9Dq1HcD7s6HFnCiGTF8Y,184
32
32
  meilisearch_python_sdk/models/webhook.py,sha256=zSkEJJdEflinW3_seJTLQ_ZWs4w-pjTD3SS1ZawC32k,455
33
- meilisearch_python_sdk-7.2.1.dist-info/METADATA,sha256=nCa6S-dVAJCgOHdg1WK0hlDYWyIc5ar4SpZqBZ5S-8Q,9597
34
- meilisearch_python_sdk-7.2.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
35
- meilisearch_python_sdk-7.2.1.dist-info/licenses/LICENSE,sha256=xVzevI1TrlKfM0plmJ7vfK1Muu0V9n-dGE8RnDrOFlM,1069
36
- meilisearch_python_sdk-7.2.1.dist-info/RECORD,,
33
+ meilisearch_python_sdk-7.2.3.dist-info/METADATA,sha256=2HxF6rIEcTCw2S77NMx2rw6iTMoAizszeWlxtQWyXxA,9597
34
+ meilisearch_python_sdk-7.2.3.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
35
+ meilisearch_python_sdk-7.2.3.dist-info/licenses/LICENSE,sha256=xVzevI1TrlKfM0plmJ7vfK1Muu0V9n-dGE8RnDrOFlM,1069
36
+ meilisearch_python_sdk-7.2.3.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.29.0
2
+ Generator: hatchling 1.30.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any