meilisearch-python-sdk 7.1.1__tar.gz → 7.1.3__tar.gz

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.
Files changed (110) hide show
  1. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/.github/workflows/docs_publish.yml +1 -1
  2. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/.github/workflows/nightly_testing.yml +1 -1
  3. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/.github/workflows/pypi_publish.yml +1 -1
  4. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/.github/workflows/testing.yml +10 -10
  5. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/.pre-commit-config.yaml +3 -3
  6. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/PKG-INFO +1 -1
  7. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docker-compose.https.yml +1 -1
  8. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docker-compose.yml +1 -1
  9. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/_batch.py +29 -18
  10. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/_client/_async_client.py +13 -3
  11. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/_client/_client.py +13 -3
  12. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/_http_requests.py +0 -1
  13. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/_task.py +30 -22
  14. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/_utils.py +0 -11
  15. meilisearch_python_sdk-7.1.3/meilisearch_python_sdk/_version.py +1 -0
  16. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/index/async_index.py +10 -2
  17. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/index/index.py +17 -3
  18. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/models/settings.py +2 -2
  19. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/types.py +3 -0
  20. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/pyproject.toml +4 -4
  21. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/conftest.py +12 -6
  22. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/test_async_client.py +4 -2
  23. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/test_async_documents.py +332 -97
  24. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/test_async_index.py +196 -70
  25. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/test_async_search.py +17 -15
  26. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/test_documents.py +164 -89
  27. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/test_index.py +70 -70
  28. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/test_search.py +15 -15
  29. meilisearch_python_sdk-7.1.3/uv.lock +1562 -0
  30. meilisearch_python_sdk-7.1.1/meilisearch_python_sdk/_version.py +0 -1
  31. meilisearch_python_sdk-7.1.1/uv.lock +0 -1548
  32. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/.github/FUNDING.yml +0 -0
  33. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/.github/release-draft-template.yaml +0 -0
  34. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/.github/renovate.json5 +0 -0
  35. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/.github/workflows/release-drafter.yml +0 -0
  36. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/.gitignore +0 -0
  37. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/CONTRIBUTING.md +0 -0
  38. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/LICENSE +0 -0
  39. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/README.md +0 -0
  40. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/assets/add_in_batches.png +0 -0
  41. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/assets/searches.png +0 -0
  42. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/codecov.yml +0 -0
  43. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/datasets/small_movies.json +0 -0
  44. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docs/.nojekyll +0 -0
  45. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docs/CNAME +0 -0
  46. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docs/async_client_api.md +0 -0
  47. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docs/async_index_api.md +0 -0
  48. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docs/client_api.md +0 -0
  49. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docs/css/custom.css +0 -0
  50. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docs/decorators_api.md +0 -0
  51. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docs/index.md +0 -0
  52. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docs/index_api.md +0 -0
  53. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docs/js/umami.js +0 -0
  54. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docs/json_handler.md +0 -0
  55. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docs/overrides/partials/footer.html +0 -0
  56. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docs/plugins.md +0 -0
  57. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/docs/pydantic.md +0 -0
  58. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/.gitignore +0 -0
  59. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/README.md +0 -0
  60. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/__init__.py +0 -0
  61. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/add_documents_decorator.py +0 -0
  62. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/add_documents_in_batches.py +0 -0
  63. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/async_add_documents_decorator.py +0 -0
  64. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/async_add_documents_in_batches.py +0 -0
  65. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/async_documents_and_search_results.py +0 -0
  66. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/async_search_tracker.py +0 -0
  67. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/async_update_settings.py +0 -0
  68. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/documents_and_search_results.py +0 -0
  69. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/fastapi_example.py +0 -0
  70. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/orjson_example.py +0 -0
  71. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/pyproject.toml +0 -0
  72. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/requirements.txt +0 -0
  73. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/search_tracker.py +0 -0
  74. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/tests/__init__.py +0 -0
  75. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/tests/conftest.py +0 -0
  76. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/tests/test_async_examples.py +0 -0
  77. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/tests/test_examples.py +0 -0
  78. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/examples/update_settings.py +0 -0
  79. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/justfile +0 -0
  80. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/__init__.py +0 -0
  81. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/_client/__init__.py +0 -0
  82. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/_client/_base_client.py +0 -0
  83. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/_client/_common.py +0 -0
  84. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/decorators.py +0 -0
  85. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/errors.py +0 -0
  86. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/index/__init__.py +0 -0
  87. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/index/_common.py +0 -0
  88. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/json_handler.py +0 -0
  89. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/models/__init__.py +0 -0
  90. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/models/batch.py +0 -0
  91. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/models/client.py +0 -0
  92. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/models/documents.py +0 -0
  93. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/models/health.py +0 -0
  94. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/models/index.py +0 -0
  95. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/models/search.py +0 -0
  96. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/models/task.py +0 -0
  97. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/models/version.py +0 -0
  98. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/models/webhook.py +0 -0
  99. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/plugins.py +0 -0
  100. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/meilisearch_python_sdk/py.typed +0 -0
  101. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/mkdocs.yaml +0 -0
  102. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/__init__.py +0 -0
  103. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/test_async_index_plugins.py +0 -0
  104. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/test_client.py +0 -0
  105. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/test_decorators.py +0 -0
  106. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/test_errors.py +0 -0
  107. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/test_http_requests.py +0 -0
  108. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/test_index_plugins.py +0 -0
  109. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/test_settings_models.py +0 -0
  110. {meilisearch_python_sdk-7.1.1 → meilisearch_python_sdk-7.1.3}/tests/test_version.py +0 -0
@@ -12,7 +12,7 @@ jobs:
12
12
  steps:
13
13
  - uses: actions/checkout@v6
14
14
  - name: Install uv
15
- uses: astral-sh/setup-uv@v7
15
+ uses: astral-sh/setup-uv@v8.1.0
16
16
  with:
17
17
  enable-cache: true
18
18
  - name: Set up Python
@@ -14,7 +14,7 @@ jobs:
14
14
  steps:
15
15
  - uses: actions/checkout@v6
16
16
  - name: Install uv
17
- uses: astral-sh/setup-uv@v7
17
+ uses: astral-sh/setup-uv@v8.1.0
18
18
  with:
19
19
  enable-cache: true
20
20
  - name: install Just
@@ -14,7 +14,7 @@ jobs:
14
14
  steps:
15
15
  - uses: actions/checkout@v6
16
16
  - name: Install uv
17
- uses: astral-sh/setup-uv@v7
17
+ uses: astral-sh/setup-uv@v8.1.0
18
18
  with:
19
19
  enable-cache: true
20
20
  - name: Set up Python
@@ -15,7 +15,7 @@ jobs:
15
15
  - name: install Just
16
16
  uses: taiki-e/install-action@just
17
17
  - name: Install uv
18
- uses: astral-sh/setup-uv@v7
18
+ uses: astral-sh/setup-uv@v8.1.0
19
19
  with:
20
20
  enable-cache: true
21
21
  - name: Set up Python
@@ -39,7 +39,7 @@ jobs:
39
39
  - name: install Just
40
40
  uses: taiki-e/install-action@just
41
41
  - name: Install uv
42
- uses: astral-sh/setup-uv@v7
42
+ uses: astral-sh/setup-uv@v8.1.0
43
43
  with:
44
44
  enable-cache: true
45
45
  - name: Set up Python ${{ matrix.python-version }}
@@ -52,7 +52,7 @@ jobs:
52
52
  - name: Test with pytest
53
53
  run: just test-parallel-ci
54
54
  - name: Upload coverage
55
- uses: codecov/codecov-action@v5.5.3
55
+ uses: codecov/codecov-action@v6.0.0
56
56
  env:
57
57
  CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
58
58
  with:
@@ -69,7 +69,7 @@ jobs:
69
69
  - name: install Just
70
70
  uses: taiki-e/install-action@just
71
71
  - name: Install uv
72
- uses: astral-sh/setup-uv@v7
72
+ uses: astral-sh/setup-uv@v8.1.0
73
73
  with:
74
74
  enable-cache: true
75
75
  - name: Set up Python ${{ matrix.python-version }}
@@ -93,7 +93,7 @@ jobs:
93
93
  - name: Test with pytest
94
94
  run: just test-parallel-ci-http2
95
95
  - name: Upload coverage
96
- uses: codecov/codecov-action@v5.5.3
96
+ uses: codecov/codecov-action@v6.0.0
97
97
  env:
98
98
  CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
99
99
  with:
@@ -110,7 +110,7 @@ jobs:
110
110
  - name: install Just
111
111
  uses: taiki-e/install-action@just
112
112
  - name: Install uv
113
- uses: astral-sh/setup-uv@v7
113
+ uses: astral-sh/setup-uv@v8.1.0
114
114
  with:
115
115
  enable-cache: true
116
116
  - name: Set up Python ${{ matrix.python-version }}
@@ -123,7 +123,7 @@ jobs:
123
123
  - name: Test with pytest
124
124
  run: just test-no-parallel-ci
125
125
  - name: Upload coverage
126
- uses: codecov/codecov-action@v5.5.3
126
+ uses: codecov/codecov-action@v6.0.0
127
127
  env:
128
128
  CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
129
129
  with:
@@ -140,7 +140,7 @@ jobs:
140
140
  - name: install Just
141
141
  uses: taiki-e/install-action@just
142
142
  - name: Install uv
143
- uses: astral-sh/setup-uv@v7
143
+ uses: astral-sh/setup-uv@v8.1.0
144
144
  with:
145
145
  enable-cache: true
146
146
  - name: Set up Python ${{ matrix.python-version }}
@@ -164,7 +164,7 @@ jobs:
164
164
  - name: Test with pytest
165
165
  run: just test-no-parallel-ci-http2
166
166
  - name: Upload coverage
167
- uses: codecov/codecov-action@v5.5.3
167
+ uses: codecov/codecov-action@v6.0.0
168
168
  env:
169
169
  CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
170
170
  with:
@@ -195,7 +195,7 @@ jobs:
195
195
  - name: install Just
196
196
  uses: taiki-e/install-action@just
197
197
  - name: Install uv
198
- uses: astral-sh/setup-uv@v7
198
+ uses: astral-sh/setup-uv@v8.1.0
199
199
  with:
200
200
  enable-cache: true
201
201
  - name: Set up Python
@@ -9,16 +9,16 @@ repos:
9
9
  - id: end-of-file-fixer
10
10
  - id: trailing-whitespace
11
11
  - repo: https://github.com/pre-commit/mirrors-mypy
12
- rev: v1.19.1
12
+ rev: v1.20.1
13
13
  hooks:
14
14
  - id: mypy
15
15
  additional_dependencies: [pydantic, orjson, types-aiofiles, types-ujson]
16
16
  - repo: https://github.com/astral-sh/ruff-pre-commit
17
- rev: v0.15.7
17
+ rev: v0.15.11
18
18
  hooks:
19
19
  - id: ruff-check
20
20
  args: [--fix, --exit-non-zero-on-fix]
21
21
  - repo: https://github.com/rvben/rumdl-pre-commit
22
- rev: v0.1.58
22
+ rev: v0.1.76
23
23
  hooks:
24
24
  - id: rumdl-fmt
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meilisearch-python-sdk
3
- Version: 7.1.1
3
+ Version: 7.1.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,6 +1,6 @@
1
1
  services:
2
2
  meilisearch:
3
- image: getmeili/meilisearch:v1.40.0
3
+ image: getmeili/meilisearch:v1.42.1
4
4
  ports:
5
5
  - "7700:7700"
6
6
  environment:
@@ -1,6 +1,6 @@
1
1
  services:
2
2
  meilisearch:
3
- image: getmeili/meilisearch:v1.40.0
3
+ image: getmeili/meilisearch:v1.42.1
4
4
  ports:
5
5
  - "7700:7700"
6
6
  environment:
@@ -2,9 +2,11 @@ from __future__ import annotations
2
2
 
3
3
  from datetime import datetime
4
4
  from typing import TYPE_CHECKING
5
+ from urllib.parse import urlencode
5
6
 
6
- from meilisearch_python_sdk._utils import get_async_client, get_client, get_json_handler
7
- from meilisearch_python_sdk.errors import BatchNotFoundError
7
+ from meilisearch_python_sdk._http_requests import AsyncHttpRequests, HttpRequests
8
+ from meilisearch_python_sdk._utils import get_async_client, get_client
9
+ from meilisearch_python_sdk.errors import BatchNotFoundError, MeilisearchApiError
8
10
  from meilisearch_python_sdk.models.batch import BatchResult, BatchStatus
9
11
 
10
12
  if TYPE_CHECKING:
@@ -15,17 +17,20 @@ if TYPE_CHECKING:
15
17
  AsyncClient,
16
18
  Client,
17
19
  )
20
+ from meilisearch_python_sdk.types import JsonHandler
18
21
 
19
22
 
20
23
  async def async_get_batch(
21
- client: HttpxAsyncClient | AsyncClient, batch_uid: int
24
+ client: HttpxAsyncClient | AsyncClient, json_handler: JsonHandler, batch_uid: int
22
25
  ) -> BatchResult | None:
23
26
  client_ = get_async_client(client)
24
- json_handler = get_json_handler(client)
25
- response = await client_.get(f"batches/{batch_uid}")
26
-
27
- if response.status_code == 404:
28
- raise BatchNotFoundError(f"Batch {batch_uid} not found")
27
+ http_requests = AsyncHttpRequests(client_, json_handler)
28
+ try:
29
+ response = await http_requests.get(f"batches/{batch_uid}")
30
+ except MeilisearchApiError as e:
31
+ if e.status_code == 404:
32
+ raise BatchNotFoundError(f"Batch {batch_uid} not found") from e
33
+ raise # pragma: no cover
29
34
 
30
35
  return BatchResult(**json_handler.loads(response.content))
31
36
 
@@ -33,6 +38,7 @@ async def async_get_batch(
33
38
  async def async_get_batches(
34
39
  client: HttpxAsyncClient | AsyncClient,
35
40
  *,
41
+ json_handler: JsonHandler,
36
42
  uids: list[int] | None = None,
37
43
  batch_uids: list[int] | None = None,
38
44
  index_uids: list[int] | None = None,
@@ -47,7 +53,7 @@ async def async_get_batches(
47
53
  after_finished_at: datetime | None = None,
48
54
  ) -> BatchStatus:
49
55
  client_ = get_async_client(client)
50
- json_handler = get_json_handler(client)
56
+ http_requests = AsyncHttpRequests(client_, json_handler)
51
57
  params = _build_parameters(
52
58
  uids=uids,
53
59
  batch_uids=batch_uids,
@@ -62,18 +68,22 @@ async def async_get_batches(
62
68
  before_started_at=before_started_at,
63
69
  after_finished_at=after_finished_at,
64
70
  )
65
- response = await client_.get("batches", params=params)
71
+ response = await http_requests.get(f"batches?{urlencode(params)}")
66
72
 
67
73
  return BatchStatus(**json_handler.loads(response.content))
68
74
 
69
75
 
70
- def get_batch(client: HttpxClient | Client, batch_uid: int) -> BatchResult | None:
76
+ def get_batch(
77
+ client: HttpxClient | Client, json_handler: JsonHandler, batch_uid: int
78
+ ) -> BatchResult | None:
71
79
  client_ = get_client(client)
72
- json_handler = get_json_handler(client)
73
- response = client_.get(f"batches/{batch_uid}")
74
-
75
- if response.status_code == 404:
76
- raise BatchNotFoundError(f"Batch {batch_uid} not found")
80
+ http_requests = HttpRequests(client_, json_handler)
81
+ try:
82
+ response = http_requests.get(f"batches/{batch_uid}")
83
+ except MeilisearchApiError as e:
84
+ if e.status_code == 404:
85
+ raise BatchNotFoundError(f"Batch {batch_uid} not found") from e
86
+ raise # pragma: no cover
77
87
 
78
88
  return BatchResult(**json_handler.loads(response.content))
79
89
 
@@ -81,6 +91,7 @@ def get_batch(client: HttpxClient | Client, batch_uid: int) -> BatchResult | Non
81
91
  def get_batches(
82
92
  client: HttpxClient | Client,
83
93
  *,
94
+ json_handler: JsonHandler,
84
95
  uids: list[int] | None = None,
85
96
  batch_uids: list[int] | None = None,
86
97
  index_uids: list[int] | None = None,
@@ -95,7 +106,7 @@ def get_batches(
95
106
  after_finished_at: datetime | None = None,
96
107
  ) -> BatchStatus:
97
108
  client_ = get_client(client)
98
- json_handler = get_json_handler(client)
109
+ http_requests = HttpRequests(client_, json_handler)
99
110
  params = _build_parameters(
100
111
  uids=uids,
101
112
  batch_uids=batch_uids,
@@ -111,7 +122,7 @@ def get_batches(
111
122
  after_finished_at=after_finished_at,
112
123
  )
113
124
 
114
- response = client_.get("batches", params=params)
125
+ response = http_requests.get(f"batches?{urlencode(params)}")
115
126
 
116
127
  return BatchStatus(**json_handler.loads(response.content))
117
128
 
@@ -866,7 +866,7 @@ class AsyncClient(BaseClient):
866
866
  return TaskInfo(**self._http_requests.parse_json(response))
867
867
 
868
868
  async def get_batch(self, batch_uid: int) -> BatchResult | None:
869
- return await async_get_batch(self, batch_uid)
869
+ return await async_get_batch(self, self.json_handler, batch_uid)
870
870
 
871
871
  async def get_batches(
872
872
  self,
@@ -886,6 +886,7 @@ class AsyncClient(BaseClient):
886
886
  ) -> BatchStatus:
887
887
  return await async_get_batches(
888
888
  self,
889
+ json_handler=self.json_handler,
889
890
  uids=uids,
890
891
  batch_uids=batch_uids,
891
892
  index_uids=index_uids,
@@ -942,6 +943,7 @@ class AsyncClient(BaseClient):
942
943
  """
943
944
  return await _task.async_cancel_tasks(
944
945
  self.http_client,
946
+ json_handler=self.json_handler,
945
947
  uids=uids,
946
948
  index_uids=index_uids,
947
949
  statuses=statuses,
@@ -973,7 +975,9 @@ class AsyncClient(BaseClient):
973
975
  >>> async with AsyncClient("http://localhost.com", "masterKey") as client:
974
976
  >>> await client.get_task(client, 1244)
975
977
  """
976
- return await _task.async_get_task(self.http_client, task_id=task_id)
978
+ return await _task.async_get_task(
979
+ self.http_client, json_handler=self.json_handler, task_id=task_id
980
+ )
977
981
 
978
982
  async def delete_tasks(
979
983
  self,
@@ -1018,6 +1022,7 @@ class AsyncClient(BaseClient):
1018
1022
  """
1019
1023
  return await _task.async_delete_tasks(
1020
1024
  self.http_client,
1025
+ json_handler=self.json_handler,
1021
1026
  uids=uids,
1022
1027
  index_uids=index_uids,
1023
1028
  statuses=statuses,
@@ -1058,7 +1063,11 @@ class AsyncClient(BaseClient):
1058
1063
  >>> await client.get_tasks()
1059
1064
  """
1060
1065
  return await _task.async_get_tasks(
1061
- self.http_client, index_ids=index_ids, types=types, reverse=reverse
1066
+ self.http_client,
1067
+ json_handler=self.json_handler,
1068
+ index_ids=index_ids,
1069
+ types=types,
1070
+ reverse=reverse,
1062
1071
  )
1063
1072
 
1064
1073
  async def wait_for_task(
@@ -1103,6 +1112,7 @@ class AsyncClient(BaseClient):
1103
1112
  return await _task.async_wait_for_task(
1104
1113
  self.http_client,
1105
1114
  task_id=task_id,
1115
+ json_handler=self.json_handler,
1106
1116
  timeout_in_ms=timeout_in_ms,
1107
1117
  interval_in_ms=interval_in_ms,
1108
1118
  raise_for_status=raise_for_status,
@@ -868,7 +868,7 @@ class Client(BaseClient):
868
868
  return TaskInfo(**self._http_requests.parse_json(response))
869
869
 
870
870
  def get_batch(self, batch_uid: int) -> BatchResult | None:
871
- return _get_batch(self, batch_uid)
871
+ return _get_batch(self, self.json_handler, batch_uid)
872
872
 
873
873
  def get_batches(
874
874
  self,
@@ -888,6 +888,7 @@ class Client(BaseClient):
888
888
  ) -> BatchStatus:
889
889
  return _get_batches(
890
890
  self,
891
+ json_handler=self.json_handler,
891
892
  uids=uids,
892
893
  batch_uids=batch_uids,
893
894
  index_uids=index_uids,
@@ -945,6 +946,7 @@ class Client(BaseClient):
945
946
  """
946
947
  return _task.cancel_tasks(
947
948
  self.http_client,
949
+ json_handler=self.json_handler,
948
950
  uids=uids,
949
951
  index_uids=index_uids,
950
952
  statuses=statuses,
@@ -997,6 +999,7 @@ class Client(BaseClient):
997
999
  """
998
1000
  return _task.delete_tasks(
999
1001
  self.http_client,
1002
+ json_handler=self.json_handler,
1000
1003
  uids=uids,
1001
1004
  index_uids=index_uids,
1002
1005
  statuses=statuses,
@@ -1027,7 +1030,7 @@ class Client(BaseClient):
1027
1030
  >>> with Client("http://localhost.com", "masterKey") as client:
1028
1031
  >>> client.get_task(client, 1244)
1029
1032
  """
1030
- return _task.get_task(self.http_client, task_id=task_id)
1033
+ return _task.get_task(self.http_client, self.json_handler, task_id)
1031
1034
 
1032
1035
  def get_tasks(
1033
1036
  self,
@@ -1058,7 +1061,13 @@ class Client(BaseClient):
1058
1061
  >>> with Client("http://localhost.com", "masterKey") as client:
1059
1062
  >>> client.get_tasks(client)
1060
1063
  """
1061
- return _task.get_tasks(self.http_client, index_ids=index_ids, types=types, reverse=reverse)
1064
+ return _task.get_tasks(
1065
+ self.http_client,
1066
+ json_handler=self.json_handler,
1067
+ index_ids=index_ids,
1068
+ types=types,
1069
+ reverse=reverse,
1070
+ )
1062
1071
 
1063
1072
  def wait_for_task(
1064
1073
  self,
@@ -1102,6 +1111,7 @@ class Client(BaseClient):
1102
1111
  return _task.wait_for_task(
1103
1112
  self.http_client,
1104
1113
  task_id=task_id,
1114
+ json_handler=self.json_handler,
1105
1115
  timeout_in_ms=timeout_in_ms,
1106
1116
  interval_in_ms=interval_in_ms,
1107
1117
  raise_for_status=raise_for_status,
@@ -70,7 +70,6 @@ class AsyncHttpRequests:
70
70
  body = gzip.compress(data)
71
71
 
72
72
  response = await http_method(path, content=body, headers=headers)
73
-
74
73
  response.raise_for_status()
75
74
  return response
76
75
 
@@ -10,17 +10,19 @@ from httpx import AsyncClient as HttpxAsyncClient
10
10
  from httpx import Client as HttpxClient
11
11
 
12
12
  from meilisearch_python_sdk._http_requests import AsyncHttpRequests, HttpRequests
13
- from meilisearch_python_sdk._utils import get_async_client, get_client, get_json_handler
13
+ from meilisearch_python_sdk._utils import get_async_client, get_client
14
14
  from meilisearch_python_sdk.errors import MeilisearchTaskFailedError, MeilisearchTimeoutError
15
15
  from meilisearch_python_sdk.models.task import TaskInfo, TaskResult, TaskStatus
16
16
 
17
17
  if TYPE_CHECKING:
18
18
  from meilisearch_python_sdk._client import AsyncClient, Client # pragma: no cover
19
+ from meilisearch_python_sdk.types import JsonHandler
19
20
 
20
21
 
21
22
  async def async_cancel_tasks(
22
23
  client: HttpxAsyncClient | AsyncClient,
23
24
  *,
25
+ json_handler: JsonHandler,
24
26
  uids: list[int] | None = None,
25
27
  index_uids: list[int] | None = None,
26
28
  statuses: list[str] | None = None,
@@ -77,8 +79,8 @@ async def async_cancel_tasks(
77
79
 
78
80
  url = f"tasks/cancel?{urlencode(parameters)}"
79
81
  client_ = get_async_client(client)
80
- json_handler = get_json_handler(client)
81
- response = await client_.post(url)
82
+ http_requests = AsyncHttpRequests(client_, json_handler)
83
+ response = await http_requests.post(url)
82
84
 
83
85
  return TaskInfo(**json_handler.loads(response.content))
84
86
 
@@ -86,6 +88,7 @@ async def async_cancel_tasks(
86
88
  async def async_delete_tasks(
87
89
  client: HttpxAsyncClient | AsyncClient,
88
90
  *,
91
+ json_handler: JsonHandler,
89
92
  uids: list[int] | None = None,
90
93
  index_uids: list[int] | None = None,
91
94
  statuses: list[str] | None = None,
@@ -112,19 +115,20 @@ async def async_delete_tasks(
112
115
 
113
116
  url = f"tasks?{urlencode(parameters)}"
114
117
  client_ = get_async_client(client)
115
- json_handler = get_json_handler(client)
116
- response = await client_.delete(url)
118
+ http_requests = AsyncHttpRequests(client_, json_handler)
119
+ response = await http_requests.delete(url)
117
120
 
118
121
  return TaskInfo(**json_handler.loads(response.content))
119
122
 
120
123
 
121
124
  async def async_get_task(
122
125
  client: HttpxAsyncClient | AsyncClient,
126
+ json_handler: JsonHandler,
123
127
  task_id: int,
124
128
  ) -> TaskResult:
125
129
  client_ = get_async_client(client)
126
- json_handler = get_json_handler(client)
127
- response = await client_.get(f"tasks/{task_id}")
130
+ http_requests = AsyncHttpRequests(client_, json_handler)
131
+ response = await http_requests.get(f"tasks/{task_id}")
128
132
 
129
133
  return TaskResult(**json_handler.loads(response.content))
130
134
 
@@ -132,6 +136,7 @@ async def async_get_task(
132
136
  async def async_get_tasks(
133
137
  client: HttpxAsyncClient | AsyncClient,
134
138
  *,
139
+ json_handler: JsonHandler,
135
140
  index_ids: list[str] | None = None,
136
141
  types: str | list[str] | None = None,
137
142
  reverse: bool | None = None,
@@ -147,8 +152,8 @@ async def async_get_tasks(
147
152
  else f"{url}?reverse={str(reverse).lower()}"
148
153
  )
149
154
  client_ = get_async_client(client)
150
- json_handler = get_json_handler(client)
151
- response = await client_.get(url)
155
+ http_requests = AsyncHttpRequests(client_, json_handler)
156
+ response = await http_requests.get(url)
152
157
 
153
158
  return TaskStatus(**json_handler.loads(response.content))
154
159
 
@@ -157,14 +162,14 @@ async def async_wait_for_task(
157
162
  client: HttpxAsyncClient | AsyncClient,
158
163
  task_id: int,
159
164
  *,
165
+ json_handler: JsonHandler,
160
166
  timeout_in_ms: int | None = 5000,
161
167
  interval_in_ms: int = 50,
162
168
  raise_for_status: bool = False,
163
169
  ) -> TaskResult:
164
170
  client_ = get_async_client(client)
165
- json_handler = get_json_handler(client)
166
- url = f"tasks/{task_id}"
167
171
  http_requests = AsyncHttpRequests(client_, json_handler)
172
+ url = f"tasks/{task_id}"
168
173
  start_time = datetime.now()
169
174
  elapsed_time = 0.0
170
175
 
@@ -196,6 +201,7 @@ async def async_wait_for_task(
196
201
  def cancel_tasks(
197
202
  client: HttpxClient | Client,
198
203
  *,
204
+ json_handler: JsonHandler,
199
205
  uids: list[int] | None = None,
200
206
  index_uids: list[int] | None = None,
201
207
  statuses: list[str] | None = None,
@@ -222,8 +228,8 @@ def cancel_tasks(
222
228
 
223
229
  url = f"tasks/cancel?{urlencode(parameters)}"
224
230
  client_ = get_client(client)
225
- json_handler = get_json_handler(client)
226
- response = client_.post(url)
231
+ http_requests = HttpRequests(client_, json_handler)
232
+ response = http_requests.post(url)
227
233
 
228
234
  return TaskInfo(**json_handler.loads(response.content))
229
235
 
@@ -231,6 +237,7 @@ def cancel_tasks(
231
237
  def delete_tasks(
232
238
  client: HttpxClient | Client,
233
239
  *,
240
+ json_handler: JsonHandler,
234
241
  uids: list[int] | None = None,
235
242
  index_uids: list[int] | None = None,
236
243
  statuses: list[str] | None = None,
@@ -257,16 +264,16 @@ def delete_tasks(
257
264
 
258
265
  url = f"tasks?{urlencode(parameters)}"
259
266
  client_ = get_client(client)
260
- json_handler = get_json_handler(client)
261
- response = client_.delete(url)
267
+ http_requests = HttpRequests(client_, json_handler)
268
+ response = http_requests.delete(url)
262
269
 
263
270
  return TaskInfo(**json_handler.loads(response.content))
264
271
 
265
272
 
266
- def get_task(client: HttpxClient | Client, task_id: int) -> TaskResult:
273
+ def get_task(client: HttpxClient | Client, json_handler: JsonHandler, task_id: int) -> TaskResult:
267
274
  client_ = get_client(client)
268
- json_handler = get_json_handler(client)
269
- response = client_.get(f"tasks/{task_id}")
275
+ http_requests = HttpRequests(client_, json_handler)
276
+ response = http_requests.get(f"tasks/{task_id}")
270
277
 
271
278
  return TaskResult(**json_handler.loads(response.content))
272
279
 
@@ -274,6 +281,7 @@ def get_task(client: HttpxClient | Client, task_id: int) -> TaskResult:
274
281
  def get_tasks(
275
282
  client: HttpxClient | Client,
276
283
  *,
284
+ json_handler: JsonHandler,
277
285
  index_ids: list[str] | None = None,
278
286
  types: str | list[str] | None = None,
279
287
  reverse: bool | None = None,
@@ -289,8 +297,8 @@ def get_tasks(
289
297
  else f"{url}?reverse={str(reverse).lower()}"
290
298
  )
291
299
  client_ = get_client(client)
292
- json_handler = get_json_handler(client)
293
- response = client_.get(url)
300
+ http_requests = HttpRequests(client_, json_handler)
301
+ response = http_requests.get(url)
294
302
 
295
303
  return TaskStatus(**json_handler.loads(response.content))
296
304
 
@@ -299,14 +307,14 @@ def wait_for_task(
299
307
  client: HttpxClient | Client,
300
308
  task_id: int,
301
309
  *,
310
+ json_handler: JsonHandler,
302
311
  timeout_in_ms: int | None = 5000,
303
312
  interval_in_ms: int = 50,
304
313
  raise_for_status: bool = False,
305
314
  ) -> TaskResult:
306
315
  client_ = get_client(client)
307
- json_handler = get_json_handler(client)
308
- url = f"tasks/{task_id}"
309
316
  http_requests = HttpRequests(client_, json_handler=json_handler)
317
+ url = f"tasks/{task_id}"
310
318
  start_time = datetime.now()
311
319
  elapsed_time = 0.0
312
320
 
@@ -7,8 +7,6 @@ from typing import TYPE_CHECKING
7
7
  from httpx import AsyncClient as HttpxAsyncClient
8
8
  from httpx import Client as HttpxClient
9
9
 
10
- from meilisearch_python_sdk.json_handler import BuiltinHandler, OrjsonHandler
11
-
12
10
  if TYPE_CHECKING:
13
11
  from meilisearch_python_sdk._client import AsyncClient, Client # pragma: no cover
14
12
 
@@ -31,15 +29,6 @@ def get_client(
31
29
  return client.http_client
32
30
 
33
31
 
34
- def get_json_handler(
35
- client: AsyncClient | Client | HttpxAsyncClient | HttpxClient,
36
- ) -> BuiltinHandler | OrjsonHandler:
37
- if isinstance(client, (HttpxAsyncClient, HttpxClient)):
38
- return BuiltinHandler()
39
-
40
- return client.json_handler
41
-
42
-
43
32
  @lru_cache(maxsize=1)
44
33
  def use_task_groups() -> bool:
45
34
  return True if sys.version_info >= (3, 11) else False
@@ -0,0 +1 @@
1
+ VERSION = "7.1.3"
@@ -342,7 +342,10 @@ class AsyncIndex(BaseIndex):
342
342
  """
343
343
  response = await self.delete()
344
344
  status = await async_wait_for_task(
345
- self.http_client, response.task_uid, timeout_in_ms=100000
345
+ self.http_client,
346
+ response.task_uid,
347
+ timeout_in_ms=100000,
348
+ json_handler=self._json_handler,
346
349
  )
347
350
  if status.status == "succeeded":
348
351
  return True
@@ -374,6 +377,7 @@ class AsyncIndex(BaseIndex):
374
377
  self.http_client,
375
378
  self._http_requests.parse_json(response)["taskUid"],
376
379
  timeout_in_ms=100000,
380
+ json_handler=self._json_handler,
377
381
  )
378
382
  index_response = await self._http_requests.get(f"{self._base_url_with_uid}")
379
383
  self.primary_key = self._http_requests.parse_json(index_response)["primaryKey"]
@@ -489,6 +493,7 @@ class AsyncIndex(BaseIndex):
489
493
  http_client,
490
494
  http_request.parse_json(response)["taskUid"],
491
495
  timeout_in_ms=timeout_in_ms,
496
+ json_handler=handler,
492
497
  )
493
498
 
494
499
  index_response = await http_request.get(f"{url}/{uid}")
@@ -508,7 +513,10 @@ class AsyncIndex(BaseIndex):
508
513
  settings_task = await index.update_settings(settings)
509
514
  if wait:
510
515
  await async_wait_for_task(
511
- http_client, settings_task.task_uid, timeout_in_ms=timeout_in_ms
516
+ http_client,
517
+ settings_task.task_uid,
518
+ timeout_in_ms=timeout_in_ms,
519
+ json_handler=handler,
512
520
  )
513
521
 
514
522
  return index