meilisearch-python-sdk 3.6.2__tar.gz → 4.1.0__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.
Potentially problematic release.
This version of meilisearch-python-sdk might be problematic. Click here for more details.
- meilisearch_python_sdk-4.1.0/.github/renovate.json5 +10 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/.github/workflows/docs_publish.yml +1 -1
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/.github/workflows/nightly_testing.yml +1 -1
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/.github/workflows/pypi_publish.yml +1 -1
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/.github/workflows/testing.yml +6 -6
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/.pre-commit-config.yaml +2 -2
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/PKG-INFO +8 -7
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/README.md +5 -5
- meilisearch_python_sdk-4.1.0/examples/requirements.txt +4 -0
- meilisearch_python_sdk-4.1.0/meilisearch_python_sdk/_batch.py +166 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/_client.py +92 -12
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/_http_requests.py +1 -1
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/_task.py +39 -39
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/_utils.py +25 -0
- meilisearch_python_sdk-4.1.0/meilisearch_python_sdk/_version.py +1 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/errors.py +4 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/index.py +282 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/json_handler.py +1 -4
- meilisearch_python_sdk-4.1.0/meilisearch_python_sdk/models/batch.py +55 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/models/settings.py +3 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/models/task.py +2 -0
- meilisearch_python_sdk-4.1.0/meilisearch_python_sdk/types.py +16 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/pyproject.toml +9 -9
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/conftest.py +2 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/test_async_client.py +72 -2
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/test_async_index.py +64 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/test_async_search.py +6 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/test_client.py +69 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/test_index.py +65 -1
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/test_search.py +6 -0
- meilisearch_python_sdk-4.1.0/uv.lock +1599 -0
- meilisearch_python_sdk-3.6.2/.github/dependabot.yaml +0 -16
- meilisearch_python_sdk-3.6.2/examples/requirements.txt +0 -4
- meilisearch_python_sdk-3.6.2/meilisearch_python_sdk/_version.py +0 -1
- meilisearch_python_sdk-3.6.2/meilisearch_python_sdk/types.py +0 -14
- meilisearch_python_sdk-3.6.2/uv.lock +0 -1572
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/.github/FUNDING.yml +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/.github/release-draft-template.yaml +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/.github/workflows/release-drafter.yml +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/.gitignore +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/CONTRIBUTING.md +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/LICENSE +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/assets/add_in_batches.png +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/assets/searches.png +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/benchmark/run_benchmark.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/codecov.yml +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/datasets/small_movies.json +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/docker-compose.https.yml +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/docker-compose.yml +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/docs/.nojekyll +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/docs/CNAME +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/docs/async_client_api.md +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/docs/async_index_api.md +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/docs/client_api.md +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/docs/css/custom.css +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/docs/decorators_api.md +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/docs/index.md +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/docs/index_api.md +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/docs/js/umami.js +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/docs/json_handler.md +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/docs/plugins.md +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/docs/pydantic.md +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/.gitignore +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/README.md +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/__init__.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/add_documents_decorator.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/add_documents_in_batches.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/async_add_documents_decorator.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/async_add_documents_in_batches.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/async_documents_and_search_results.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/async_search_tracker.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/async_update_settings.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/documents_and_search_results.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/fastapi_example.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/orjson_example.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/pyproject.toml +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/search_tracker.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/tests/__init__.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/tests/conftest.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/tests/test_async_examples.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/tests/test_examples.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/ujson_example.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/examples/update_settings.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/justfile +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/__init__.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/decorators.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/models/__init__.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/models/client.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/models/documents.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/models/health.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/models/index.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/models/search.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/models/version.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/plugins.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/py.typed +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/mkdocs.yaml +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/__init__.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/test_async_documents.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/test_async_index_plugins.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/test_decorators.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/test_documents.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/test_errors.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/test_index_plugins.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/test_utils.py +0 -0
- {meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/tests/test_version.py +0 -0
|
@@ -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@
|
|
18
|
+
uses: astral-sh/setup-uv@v5
|
|
19
19
|
with:
|
|
20
20
|
enable-cache: true
|
|
21
21
|
- name: Set up Python
|
|
@@ -38,7 +38,7 @@ jobs:
|
|
|
38
38
|
- name: install Just
|
|
39
39
|
uses: taiki-e/install-action@just
|
|
40
40
|
- name: Install uv
|
|
41
|
-
uses: astral-sh/setup-uv@
|
|
41
|
+
uses: astral-sh/setup-uv@v5
|
|
42
42
|
with:
|
|
43
43
|
enable-cache: true
|
|
44
44
|
- name: Set up Python ${{ matrix.python-version }}
|
|
@@ -66,7 +66,7 @@ jobs:
|
|
|
66
66
|
- name: install Just
|
|
67
67
|
uses: taiki-e/install-action@just
|
|
68
68
|
- name: Install uv
|
|
69
|
-
uses: astral-sh/setup-uv@
|
|
69
|
+
uses: astral-sh/setup-uv@v5
|
|
70
70
|
with:
|
|
71
71
|
enable-cache: true
|
|
72
72
|
- name: Set up Python ${{ matrix.python-version }}
|
|
@@ -106,7 +106,7 @@ jobs:
|
|
|
106
106
|
- name: install Just
|
|
107
107
|
uses: taiki-e/install-action@just
|
|
108
108
|
- name: Install uv
|
|
109
|
-
uses: astral-sh/setup-uv@
|
|
109
|
+
uses: astral-sh/setup-uv@v5
|
|
110
110
|
with:
|
|
111
111
|
enable-cache: true
|
|
112
112
|
- name: Set up Python ${{ matrix.python-version }}
|
|
@@ -134,7 +134,7 @@ jobs:
|
|
|
134
134
|
- name: install Just
|
|
135
135
|
uses: taiki-e/install-action@just
|
|
136
136
|
- name: Install uv
|
|
137
|
-
uses: astral-sh/setup-uv@
|
|
137
|
+
uses: astral-sh/setup-uv@v5
|
|
138
138
|
with:
|
|
139
139
|
enable-cache: true
|
|
140
140
|
- name: Set up Python ${{ matrix.python-version }}
|
|
@@ -187,7 +187,7 @@ jobs:
|
|
|
187
187
|
- name: install Just
|
|
188
188
|
uses: taiki-e/install-action@just
|
|
189
189
|
- name: Install uv
|
|
190
|
-
uses: astral-sh/setup-uv@
|
|
190
|
+
uses: astral-sh/setup-uv@v5
|
|
191
191
|
with:
|
|
192
192
|
enable-cache: true
|
|
193
193
|
- name: Set up Python
|
|
@@ -9,12 +9,12 @@ 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.
|
|
12
|
+
rev: v1.14.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.
|
|
17
|
+
rev: v0.9.3
|
|
18
18
|
hooks:
|
|
19
19
|
- id: ruff
|
|
20
20
|
args: [--fix, --exit-non-zero-on-fix]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: meilisearch-python-sdk
|
|
3
|
-
Version:
|
|
3
|
+
Version: 4.1.0
|
|
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
|
|
@@ -27,6 +27,7 @@ License: MIT License
|
|
|
27
27
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
28
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
29
|
SOFTWARE.
|
|
30
|
+
License-File: LICENSE
|
|
30
31
|
Keywords: async,client,meilisearch,python,sdk
|
|
31
32
|
Classifier: Development Status :: 5 - Production/Stable
|
|
32
33
|
Classifier: Intended Audience :: Developers
|
|
@@ -56,7 +57,7 @@ Description-Content-Type: text/markdown
|
|
|
56
57
|
|
|
57
58
|
# Meilisearch Python SDK
|
|
58
59
|
|
|
59
|
-
[](https://github.com/sanders41/meilisearch-python-sdk/actions?query=workflow%3ATesting+branch%3Amain+event%3Apush)
|
|
60
61
|
[](https://results.pre-commit.ci/latest/github/sanders41/meilisearch-python-sdk/main)
|
|
61
62
|
[](https://codecov.io/gh/sanders41/meilisearch-python-sdk)
|
|
62
63
|
[](https://badge.fury.io/py/meilisearch-python-sdk)
|
|
@@ -141,15 +142,15 @@ variable, this will be an `UpdateId` object, and use it to check the status of t
|
|
|
141
142
|
#### AsyncClient
|
|
142
143
|
|
|
143
144
|
```py
|
|
144
|
-
|
|
145
|
-
status = await client.
|
|
145
|
+
task = await index.add_documents([{"id": 1, "title": "test"}])
|
|
146
|
+
status = await client.get_task(task.task_uid)
|
|
146
147
|
```
|
|
147
148
|
|
|
148
149
|
#### Client
|
|
149
150
|
|
|
150
151
|
```py
|
|
151
|
-
|
|
152
|
-
status = client.
|
|
152
|
+
task = index.add_documents([{"id": 1, "title": "test"}])
|
|
153
|
+
status = client.get_task(task.task_uid)
|
|
153
154
|
```
|
|
154
155
|
|
|
155
156
|
### Basic Searching
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Meilisearch Python SDK
|
|
2
2
|
|
|
3
|
-
[](https://github.com/sanders41/meilisearch-python-sdk/actions?query=workflow%3ATesting+branch%3Amain+event%3Apush)
|
|
4
4
|
[](https://results.pre-commit.ci/latest/github/sanders41/meilisearch-python-sdk/main)
|
|
5
5
|
[](https://codecov.io/gh/sanders41/meilisearch-python-sdk)
|
|
6
6
|
[](https://badge.fury.io/py/meilisearch-python-sdk)
|
|
@@ -85,15 +85,15 @@ variable, this will be an `UpdateId` object, and use it to check the status of t
|
|
|
85
85
|
#### AsyncClient
|
|
86
86
|
|
|
87
87
|
```py
|
|
88
|
-
|
|
89
|
-
status = await client.
|
|
88
|
+
task = await index.add_documents([{"id": 1, "title": "test"}])
|
|
89
|
+
status = await client.get_task(task.task_uid)
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
#### Client
|
|
93
93
|
|
|
94
94
|
```py
|
|
95
|
-
|
|
96
|
-
status = client.
|
|
95
|
+
task = index.add_documents([{"id": 1, "title": "test"}])
|
|
96
|
+
status = client.get_task(task.task_uid)
|
|
97
97
|
```
|
|
98
98
|
|
|
99
99
|
### Basic Searching
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
from meilisearch_python_sdk._utils import get_async_client, get_client
|
|
7
|
+
from meilisearch_python_sdk.errors import BatchNotFoundError
|
|
8
|
+
from meilisearch_python_sdk.models.batch import BatchResult, BatchStatus
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from httpx import AsyncClient as HttpxAsyncClient # pragma: no cover
|
|
12
|
+
from httpx import Client as HttpxClient # pragma: no cover
|
|
13
|
+
|
|
14
|
+
from meilisearch_python_sdk._client import ( # pragma: no cover
|
|
15
|
+
AsyncClient,
|
|
16
|
+
Client,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
async def async_get_batch(
|
|
21
|
+
client: HttpxAsyncClient | AsyncClient, batch_uid: int
|
|
22
|
+
) -> BatchResult | None:
|
|
23
|
+
client_ = get_async_client(client)
|
|
24
|
+
response = await client_.get(f"batches/{batch_uid}")
|
|
25
|
+
|
|
26
|
+
if response.status_code == 404:
|
|
27
|
+
raise BatchNotFoundError(f"Batch {batch_uid} not found")
|
|
28
|
+
|
|
29
|
+
return BatchResult(**response.json())
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
async def async_get_batches(
|
|
33
|
+
client: HttpxAsyncClient | AsyncClient,
|
|
34
|
+
*,
|
|
35
|
+
uids: list[int] | None = None,
|
|
36
|
+
batch_uids: list[int] | None = None,
|
|
37
|
+
index_uids: list[int] | None = None,
|
|
38
|
+
statuses: list[str] | None = None,
|
|
39
|
+
types: list[str] | None = None,
|
|
40
|
+
limit: int = 20,
|
|
41
|
+
from_: str | None = None,
|
|
42
|
+
reverse: bool = False,
|
|
43
|
+
before_enqueued_at: datetime | None = None,
|
|
44
|
+
after_enqueued_at: datetime | None = None,
|
|
45
|
+
before_started_at: datetime | None = None,
|
|
46
|
+
after_finished_at: datetime | None = None,
|
|
47
|
+
) -> BatchStatus:
|
|
48
|
+
client_ = get_async_client(client)
|
|
49
|
+
params = _build_parameters(
|
|
50
|
+
uids=uids,
|
|
51
|
+
batch_uids=batch_uids,
|
|
52
|
+
index_uids=index_uids,
|
|
53
|
+
statuses=statuses,
|
|
54
|
+
types=types,
|
|
55
|
+
limit=limit,
|
|
56
|
+
from_=from_,
|
|
57
|
+
reverse=reverse,
|
|
58
|
+
before_enqueued_at=before_enqueued_at,
|
|
59
|
+
after_enqueued_at=after_enqueued_at,
|
|
60
|
+
before_started_at=before_started_at,
|
|
61
|
+
after_finished_at=after_finished_at,
|
|
62
|
+
)
|
|
63
|
+
response = await client_.get("batches", params=params)
|
|
64
|
+
|
|
65
|
+
return BatchStatus(**response.json())
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def get_batch(client: HttpxClient | Client, batch_uid: int) -> BatchResult | None:
|
|
69
|
+
client_ = get_client(client)
|
|
70
|
+
response = client_.get(f"batches/{batch_uid}")
|
|
71
|
+
|
|
72
|
+
if response.status_code == 404:
|
|
73
|
+
raise BatchNotFoundError(f"Batch {batch_uid} not found")
|
|
74
|
+
|
|
75
|
+
return BatchResult(**response.json())
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def get_batches(
|
|
79
|
+
client: HttpxClient | Client,
|
|
80
|
+
*,
|
|
81
|
+
uids: list[int] | None = None,
|
|
82
|
+
batch_uids: list[int] | None = None,
|
|
83
|
+
index_uids: list[int] | None = None,
|
|
84
|
+
statuses: list[str] | None = None,
|
|
85
|
+
types: list[str] | None = None,
|
|
86
|
+
limit: int = 20,
|
|
87
|
+
from_: str | None = None,
|
|
88
|
+
reverse: bool = False,
|
|
89
|
+
before_enqueued_at: datetime | None = None,
|
|
90
|
+
after_enqueued_at: datetime | None = None,
|
|
91
|
+
before_started_at: datetime | None = None,
|
|
92
|
+
after_finished_at: datetime | None = None,
|
|
93
|
+
) -> BatchStatus:
|
|
94
|
+
client_ = get_client(client)
|
|
95
|
+
params = _build_parameters(
|
|
96
|
+
uids=uids,
|
|
97
|
+
batch_uids=batch_uids,
|
|
98
|
+
index_uids=index_uids,
|
|
99
|
+
statuses=statuses,
|
|
100
|
+
types=types,
|
|
101
|
+
limit=limit,
|
|
102
|
+
from_=from_,
|
|
103
|
+
reverse=reverse,
|
|
104
|
+
before_enqueued_at=before_enqueued_at,
|
|
105
|
+
after_enqueued_at=after_enqueued_at,
|
|
106
|
+
before_started_at=before_started_at,
|
|
107
|
+
after_finished_at=after_finished_at,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
response = client_.get("batches", params=params)
|
|
111
|
+
|
|
112
|
+
return BatchStatus(**response.json())
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _build_parameters(
|
|
116
|
+
*,
|
|
117
|
+
uids: list[int] | None = None,
|
|
118
|
+
batch_uids: list[int] | None = None,
|
|
119
|
+
index_uids: list[int] | None = None,
|
|
120
|
+
statuses: list[str] | None = None,
|
|
121
|
+
types: list[str] | None = None,
|
|
122
|
+
limit: int = 20,
|
|
123
|
+
from_: str | None = None,
|
|
124
|
+
reverse: bool = False,
|
|
125
|
+
before_enqueued_at: datetime | None = None,
|
|
126
|
+
after_enqueued_at: datetime | None = None,
|
|
127
|
+
before_started_at: datetime | None = None,
|
|
128
|
+
after_finished_at: datetime | None = None,
|
|
129
|
+
) -> dict[str, str]:
|
|
130
|
+
params = {}
|
|
131
|
+
|
|
132
|
+
if uids:
|
|
133
|
+
params["uids"] = ",".join([str(uid) for uid in uids])
|
|
134
|
+
|
|
135
|
+
if batch_uids: # pragma: no cover
|
|
136
|
+
params["batchUids"] = ",".join([str(uid) for uid in batch_uids])
|
|
137
|
+
|
|
138
|
+
if index_uids: # pragma: no cover
|
|
139
|
+
params["indexUids"] = ",".join([str(uid) for uid in index_uids])
|
|
140
|
+
|
|
141
|
+
if statuses: # pragma: no cover
|
|
142
|
+
params["statuses"] = ",".join(statuses)
|
|
143
|
+
|
|
144
|
+
if types: # pragma: no cover
|
|
145
|
+
params["types"] = ",".join(types)
|
|
146
|
+
|
|
147
|
+
params["limit"] = str(limit)
|
|
148
|
+
|
|
149
|
+
if from_: # pragma: no cover
|
|
150
|
+
params["from"] = from_
|
|
151
|
+
|
|
152
|
+
params["reverse"] = "true" if reverse else "false"
|
|
153
|
+
|
|
154
|
+
if before_enqueued_at: # pragma: no cover
|
|
155
|
+
params["beforeEnqueuedAt"] = before_enqueued_at.isoformat()
|
|
156
|
+
|
|
157
|
+
if after_enqueued_at: # pragma: no cover
|
|
158
|
+
params["afterEnqueuedAt"] = after_enqueued_at.isoformat()
|
|
159
|
+
|
|
160
|
+
if before_started_at: # pragma: no cover
|
|
161
|
+
params["beforeStartedAt"] = before_started_at.isoformat()
|
|
162
|
+
|
|
163
|
+
if after_finished_at: # pragma: no cover
|
|
164
|
+
params["afterFinishedAt"] = after_finished_at.isoformat()
|
|
165
|
+
|
|
166
|
+
return params
|
{meilisearch_python_sdk-3.6.2 → meilisearch_python_sdk-4.1.0}/meilisearch_python_sdk/_client.py
RENAMED
|
@@ -9,6 +9,9 @@ from httpx import AsyncClient as HttpxAsyncClient
|
|
|
9
9
|
from httpx import Client as HttpxClient
|
|
10
10
|
|
|
11
11
|
from meilisearch_python_sdk import _task
|
|
12
|
+
from meilisearch_python_sdk._batch import async_get_batch, async_get_batches
|
|
13
|
+
from meilisearch_python_sdk._batch import get_batch as _get_batch
|
|
14
|
+
from meilisearch_python_sdk._batch import get_batches as _get_batches
|
|
12
15
|
from meilisearch_python_sdk._http_requests import AsyncHttpRequests, HttpRequests
|
|
13
16
|
from meilisearch_python_sdk.errors import InvalidRestriction, MeilisearchApiError
|
|
14
17
|
from meilisearch_python_sdk.index import AsyncIndex, Index
|
|
@@ -39,6 +42,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|
|
39
42
|
import sys
|
|
40
43
|
from types import TracebackType
|
|
41
44
|
|
|
45
|
+
from meilisearch_python_sdk.models.batch import BatchResult, BatchStatus
|
|
42
46
|
from meilisearch_python_sdk.types import JsonMapping
|
|
43
47
|
|
|
44
48
|
if sys.version_info >= (3, 11):
|
|
@@ -144,7 +148,7 @@ class AsyncClient(BaseClient):
|
|
|
144
148
|
api_key: str | None = None,
|
|
145
149
|
*,
|
|
146
150
|
timeout: int | None = None,
|
|
147
|
-
verify:
|
|
151
|
+
verify: bool | SSLContext = True,
|
|
148
152
|
custom_headers: dict[str, str] | None = None,
|
|
149
153
|
json_handler: BuiltinHandler | OrjsonHandler | UjsonHandler | None = None,
|
|
150
154
|
http2: bool = False,
|
|
@@ -770,11 +774,46 @@ class AsyncClient(BaseClient):
|
|
|
770
774
|
|
|
771
775
|
return TaskInfo(**response.json())
|
|
772
776
|
|
|
777
|
+
async def get_batch(self, batch_uid: int) -> BatchResult | None:
|
|
778
|
+
return await async_get_batch(self, batch_uid)
|
|
779
|
+
|
|
780
|
+
async def get_batches(
|
|
781
|
+
self,
|
|
782
|
+
*,
|
|
783
|
+
uids: list[int] | None = None,
|
|
784
|
+
batch_uids: list[int] | None = None,
|
|
785
|
+
index_uids: list[int] | None = None,
|
|
786
|
+
statuses: list[str] | None = None,
|
|
787
|
+
types: list[str] | None = None,
|
|
788
|
+
limit: int = 20,
|
|
789
|
+
from_: str | None = None,
|
|
790
|
+
reverse: bool = False,
|
|
791
|
+
before_enqueued_at: datetime | None = None,
|
|
792
|
+
after_enqueued_at: datetime | None = None,
|
|
793
|
+
before_started_at: datetime | None = None,
|
|
794
|
+
after_finished_at: datetime | None = None,
|
|
795
|
+
) -> BatchStatus:
|
|
796
|
+
return await async_get_batches(
|
|
797
|
+
self,
|
|
798
|
+
uids=uids,
|
|
799
|
+
batch_uids=batch_uids,
|
|
800
|
+
index_uids=index_uids,
|
|
801
|
+
statuses=statuses,
|
|
802
|
+
types=types,
|
|
803
|
+
limit=limit,
|
|
804
|
+
from_=from_,
|
|
805
|
+
reverse=reverse,
|
|
806
|
+
before_enqueued_at=before_enqueued_at,
|
|
807
|
+
after_enqueued_at=after_enqueued_at,
|
|
808
|
+
before_started_at=before_started_at,
|
|
809
|
+
after_finished_at=after_finished_at,
|
|
810
|
+
)
|
|
811
|
+
|
|
773
812
|
async def cancel_tasks(
|
|
774
813
|
self,
|
|
775
814
|
*,
|
|
776
|
-
uids: list[
|
|
777
|
-
index_uids: list[
|
|
815
|
+
uids: list[int] | None = None,
|
|
816
|
+
index_uids: list[int] | None = None,
|
|
778
817
|
statuses: list[str] | None = None,
|
|
779
818
|
types: list[str] | None = None,
|
|
780
819
|
before_enqueued_at: datetime | None = None,
|
|
@@ -848,8 +887,8 @@ class AsyncClient(BaseClient):
|
|
|
848
887
|
async def delete_tasks(
|
|
849
888
|
self,
|
|
850
889
|
*,
|
|
851
|
-
uids: list[
|
|
852
|
-
index_uids: list[
|
|
890
|
+
uids: list[int] | None = None,
|
|
891
|
+
index_uids: list[int] | None = None,
|
|
853
892
|
statuses: list[str] | None = None,
|
|
854
893
|
types: list[str] | None = None,
|
|
855
894
|
before_enqueued_at: datetime | None = None,
|
|
@@ -903,6 +942,7 @@ class AsyncClient(BaseClient):
|
|
|
903
942
|
*,
|
|
904
943
|
index_ids: list[str] | None = None,
|
|
905
944
|
types: str | list[str] | None = None,
|
|
945
|
+
reverse: bool | None = None,
|
|
906
946
|
) -> TaskStatus:
|
|
907
947
|
"""Get multiple tasks.
|
|
908
948
|
|
|
@@ -910,6 +950,7 @@ class AsyncClient(BaseClient):
|
|
|
910
950
|
index_ids: A list of index UIDs for which to get the tasks. If provided this will get the
|
|
911
951
|
tasks only for the specified indexes, if not all tasks will be returned. Default = None
|
|
912
952
|
types: Specify specific task types to retrieve. Default = None
|
|
953
|
+
reverse: If True the tasks will be returned in reverse order. Default = None
|
|
913
954
|
|
|
914
955
|
Returns:
|
|
915
956
|
Task statuses.
|
|
@@ -925,7 +966,9 @@ class AsyncClient(BaseClient):
|
|
|
925
966
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
926
967
|
>>> await client.get_tasks()
|
|
927
968
|
"""
|
|
928
|
-
return await _task.async_get_tasks(
|
|
969
|
+
return await _task.async_get_tasks(
|
|
970
|
+
self.http_client, index_ids=index_ids, types=types, reverse=reverse
|
|
971
|
+
)
|
|
929
972
|
|
|
930
973
|
async def wait_for_task(
|
|
931
974
|
self,
|
|
@@ -984,7 +1027,7 @@ class Client(BaseClient):
|
|
|
984
1027
|
api_key: str | None = None,
|
|
985
1028
|
*,
|
|
986
1029
|
timeout: int | None = None,
|
|
987
|
-
verify:
|
|
1030
|
+
verify: bool | SSLContext = True,
|
|
988
1031
|
custom_headers: dict[str, str] | None = None,
|
|
989
1032
|
json_handler: BuiltinHandler | OrjsonHandler | UjsonHandler | None = None,
|
|
990
1033
|
http2: bool = False,
|
|
@@ -1586,11 +1629,46 @@ class Client(BaseClient):
|
|
|
1586
1629
|
|
|
1587
1630
|
return TaskInfo(**response.json())
|
|
1588
1631
|
|
|
1632
|
+
def get_batch(self, batch_uid: int) -> BatchResult | None:
|
|
1633
|
+
return _get_batch(self, batch_uid)
|
|
1634
|
+
|
|
1635
|
+
def get_batches(
|
|
1636
|
+
self,
|
|
1637
|
+
*,
|
|
1638
|
+
uids: list[int] | None = None,
|
|
1639
|
+
batch_uids: list[int] | None = None,
|
|
1640
|
+
index_uids: list[int] | None = None,
|
|
1641
|
+
statuses: list[str] | None = None,
|
|
1642
|
+
types: list[str] | None = None,
|
|
1643
|
+
limit: int = 20,
|
|
1644
|
+
from_: str | None = None,
|
|
1645
|
+
reverse: bool = False,
|
|
1646
|
+
before_enqueued_at: datetime | None = None,
|
|
1647
|
+
after_enqueued_at: datetime | None = None,
|
|
1648
|
+
before_started_at: datetime | None = None,
|
|
1649
|
+
after_finished_at: datetime | None = None,
|
|
1650
|
+
) -> BatchStatus:
|
|
1651
|
+
return _get_batches(
|
|
1652
|
+
self,
|
|
1653
|
+
uids=uids,
|
|
1654
|
+
batch_uids=batch_uids,
|
|
1655
|
+
index_uids=index_uids,
|
|
1656
|
+
statuses=statuses,
|
|
1657
|
+
types=types,
|
|
1658
|
+
limit=limit,
|
|
1659
|
+
from_=from_,
|
|
1660
|
+
reverse=reverse,
|
|
1661
|
+
before_enqueued_at=before_enqueued_at,
|
|
1662
|
+
after_enqueued_at=after_enqueued_at,
|
|
1663
|
+
before_started_at=before_started_at,
|
|
1664
|
+
after_finished_at=after_finished_at,
|
|
1665
|
+
)
|
|
1666
|
+
|
|
1589
1667
|
def cancel_tasks(
|
|
1590
1668
|
self,
|
|
1591
1669
|
*,
|
|
1592
|
-
uids: list[
|
|
1593
|
-
index_uids: list[
|
|
1670
|
+
uids: list[int] | None = None,
|
|
1671
|
+
index_uids: list[int] | None = None,
|
|
1594
1672
|
statuses: list[str] | None = None,
|
|
1595
1673
|
types: list[str] | None = None,
|
|
1596
1674
|
before_enqueued_at: datetime | None = None,
|
|
@@ -1642,8 +1720,8 @@ class Client(BaseClient):
|
|
|
1642
1720
|
def delete_tasks(
|
|
1643
1721
|
self,
|
|
1644
1722
|
*,
|
|
1645
|
-
uids: list[
|
|
1646
|
-
index_uids: list[
|
|
1723
|
+
uids: list[int] | None = None,
|
|
1724
|
+
index_uids: list[int] | None = None,
|
|
1647
1725
|
statuses: list[str] | None = None,
|
|
1648
1726
|
types: list[str] | None = None,
|
|
1649
1727
|
before_enqueued_at: datetime | None = None,
|
|
@@ -1718,6 +1796,7 @@ class Client(BaseClient):
|
|
|
1718
1796
|
*,
|
|
1719
1797
|
index_ids: list[str] | None = None,
|
|
1720
1798
|
types: str | list[str] | None = None,
|
|
1799
|
+
reverse: bool | None = None,
|
|
1721
1800
|
) -> TaskStatus:
|
|
1722
1801
|
"""Get multiple tasks.
|
|
1723
1802
|
|
|
@@ -1725,6 +1804,7 @@ class Client(BaseClient):
|
|
|
1725
1804
|
index_ids: A list of index UIDs for which to get the tasks. If provided this will get the
|
|
1726
1805
|
tasks only for the specified indexes, if not all tasks will be returned. Default = None
|
|
1727
1806
|
types: Specify specific task types to retrieve. Default = None
|
|
1807
|
+
reverse: If True the tasks will be returned in reverse order. Default = None
|
|
1728
1808
|
|
|
1729
1809
|
Returns:
|
|
1730
1810
|
Task statuses.
|
|
@@ -1740,7 +1820,7 @@ class Client(BaseClient):
|
|
|
1740
1820
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1741
1821
|
>>> client.get_tasks(client)
|
|
1742
1822
|
"""
|
|
1743
|
-
return _task.get_tasks(self.http_client, index_ids=index_ids, types=types)
|
|
1823
|
+
return _task.get_tasks(self.http_client, index_ids=index_ids, types=types, reverse=reverse)
|
|
1744
1824
|
|
|
1745
1825
|
def wait_for_task(
|
|
1746
1826
|
self,
|
|
@@ -116,7 +116,7 @@ class HttpRequests:
|
|
|
116
116
|
http_method: Callable,
|
|
117
117
|
path: str,
|
|
118
118
|
body: Any | None = None,
|
|
119
|
-
content_type: str = "
|
|
119
|
+
content_type: str = "application/json",
|
|
120
120
|
compress: bool = False,
|
|
121
121
|
) -> Response:
|
|
122
122
|
headers = build_headers(content_type, compress)
|