meilisearch-python-sdk 4.10.0__tar.gz → 4.11.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.10.0 → meilisearch_python_sdk-4.11.0}/.pre-commit-config.yaml +2 -2
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/PKG-INFO +1 -1
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/_client.py +237 -0
- meilisearch_python_sdk-4.11.0/meilisearch_python_sdk/_version.py +1 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/index.py +22 -22
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/models/settings.py +1 -1
- meilisearch_python_sdk-4.11.0/meilisearch_python_sdk/models/webhook.py +24 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/pyproject.toml +4 -4
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/conftest.py +16 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/test_async_client.py +46 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/test_async_index.py +2 -1
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/test_client.py +46 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/test_index.py +2 -1
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/uv.lock +354 -292
- meilisearch_python_sdk-4.10.0/meilisearch_python_sdk/_version.py +0 -1
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/.github/FUNDING.yml +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/.github/release-draft-template.yaml +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/.github/renovate.json5 +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/.github/workflows/docs_publish.yml +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/.github/workflows/nightly_testing.yml +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/.github/workflows/pypi_publish.yml +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/.github/workflows/release-drafter.yml +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/.github/workflows/testing.yml +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/.gitignore +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/CONTRIBUTING.md +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/LICENSE +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/README.md +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/assets/add_in_batches.png +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/assets/searches.png +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/codecov.yml +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/datasets/small_movies.json +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docker-compose.https.yml +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docker-compose.yml +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docs/.nojekyll +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docs/CNAME +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docs/async_client_api.md +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docs/async_index_api.md +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docs/client_api.md +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docs/css/custom.css +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docs/decorators_api.md +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docs/index.md +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docs/index_api.md +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docs/js/umami.js +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docs/json_handler.md +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docs/overrides/partials/footer.html +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docs/plugins.md +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/docs/pydantic.md +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/.gitignore +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/README.md +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/__init__.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/add_documents_decorator.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/add_documents_in_batches.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/async_add_documents_decorator.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/async_add_documents_in_batches.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/async_documents_and_search_results.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/async_search_tracker.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/async_update_settings.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/documents_and_search_results.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/fastapi_example.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/orjson_example.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/pyproject.toml +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/requirements.txt +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/search_tracker.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/tests/__init__.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/tests/conftest.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/tests/test_async_examples.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/tests/test_examples.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/ujson_example.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/examples/update_settings.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/justfile +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/__init__.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/_batch.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/_http_requests.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/_task.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/_utils.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/decorators.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/errors.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/json_handler.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/models/__init__.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/models/batch.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/models/client.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/models/documents.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/models/health.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/models/index.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/models/search.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/models/task.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/models/version.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/plugins.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/py.typed +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/types.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/mkdocs.yaml +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/__init__.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/test_async_documents.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/test_async_index_plugins.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/test_async_search.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/test_decorators.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/test_documents.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/test_errors.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/test_index_plugins.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/test_search.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/test_settings_models.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/test_utils.py +0 -0
- {meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/tests/test_version.py +0 -0
|
@@ -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.18.
|
|
12
|
+
rev: v1.18.2
|
|
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.13.
|
|
17
|
+
rev: v0.13.2
|
|
18
18
|
hooks:
|
|
19
19
|
- id: ruff-check
|
|
20
20
|
args: [--fix, --exit-non-zero-on-fix]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meilisearch-python-sdk
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.11.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
|
{meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/_client.py
RENAMED
|
@@ -36,6 +36,7 @@ from meilisearch_python_sdk.models.search import (
|
|
|
36
36
|
from meilisearch_python_sdk.models.settings import MeilisearchSettings
|
|
37
37
|
from meilisearch_python_sdk.models.task import TaskInfo, TaskResult, TaskStatus
|
|
38
38
|
from meilisearch_python_sdk.models.version import Version
|
|
39
|
+
from meilisearch_python_sdk.models.webhook import Webhook, WebhookCreate, Webhooks, WebhookUpdate
|
|
39
40
|
from meilisearch_python_sdk.plugins import AsyncIndexPlugins, IndexPlugins
|
|
40
41
|
from meilisearch_python_sdk.types import JsonDict
|
|
41
42
|
|
|
@@ -252,6 +253,124 @@ class AsyncClient(BaseClient):
|
|
|
252
253
|
|
|
253
254
|
return Network(**response.json())
|
|
254
255
|
|
|
256
|
+
async def get_webhooks(self) -> Webhooks:
|
|
257
|
+
"""Get all webhooks.
|
|
258
|
+
|
|
259
|
+
Returns:
|
|
260
|
+
An instance of Webhooks containing all configured webhooks.
|
|
261
|
+
|
|
262
|
+
Raises:
|
|
263
|
+
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
264
|
+
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
265
|
+
|
|
266
|
+
Examples:
|
|
267
|
+
>>> from meilisearch_python_sdk import AsyncClient
|
|
268
|
+
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
269
|
+
>>> webhooks = await client.get_webhooks()
|
|
270
|
+
"""
|
|
271
|
+
response = await self._http_requests.get("webhooks")
|
|
272
|
+
|
|
273
|
+
return Webhooks(**response.json())
|
|
274
|
+
|
|
275
|
+
async def get_webhook(self, uuid: str) -> Webhook:
|
|
276
|
+
"""Get a specific webhook by UUID.
|
|
277
|
+
|
|
278
|
+
Args:
|
|
279
|
+
uuid: The webhook's unique identifier.
|
|
280
|
+
|
|
281
|
+
Returns:
|
|
282
|
+
An instance of Webhook containing the webhook information.
|
|
283
|
+
|
|
284
|
+
Raises:
|
|
285
|
+
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
286
|
+
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
287
|
+
|
|
288
|
+
Examples:
|
|
289
|
+
>>> from meilisearch_python_sdk import AsyncClient
|
|
290
|
+
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
291
|
+
>>> webhook = await client.get_webhook("abc-123")
|
|
292
|
+
"""
|
|
293
|
+
response = await self._http_requests.get(f"webhooks/{uuid}")
|
|
294
|
+
|
|
295
|
+
return Webhook(**response.json())
|
|
296
|
+
|
|
297
|
+
async def create_webhook(self, webhook: WebhookCreate) -> Webhook:
|
|
298
|
+
"""Create a new webhook.
|
|
299
|
+
|
|
300
|
+
Args:
|
|
301
|
+
webhook: The webhook configuration to create.
|
|
302
|
+
|
|
303
|
+
Returns:
|
|
304
|
+
The created webhook.
|
|
305
|
+
|
|
306
|
+
Raises:
|
|
307
|
+
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
308
|
+
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
309
|
+
|
|
310
|
+
Examples:
|
|
311
|
+
>>> from meilisearch_python_sdk import AsyncClient
|
|
312
|
+
>>> from meilisearch_python_sdk.models.webhook import WebhookCreate
|
|
313
|
+
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
314
|
+
>>> webhook_config = WebhookCreate(
|
|
315
|
+
>>> url="https://example.com/webhook",
|
|
316
|
+
>>> headers={"Authorization": "Bearer token"}
|
|
317
|
+
>>> )
|
|
318
|
+
>>> webhook = await client.create_webhook(webhook_config)
|
|
319
|
+
"""
|
|
320
|
+
response = await self._http_requests.post(
|
|
321
|
+
"webhooks", webhook.model_dump(by_alias=True, exclude_none=True)
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
return Webhook(**response.json())
|
|
325
|
+
|
|
326
|
+
async def update_webhook(self, *, uuid: str, webhook: WebhookUpdate) -> Webhook:
|
|
327
|
+
"""Update an existing webhook.
|
|
328
|
+
|
|
329
|
+
Args:
|
|
330
|
+
uuid: The webhook's unique identifier.
|
|
331
|
+
webhook: The webhook configuration updates.
|
|
332
|
+
|
|
333
|
+
Returns:
|
|
334
|
+
The updated webhook.
|
|
335
|
+
|
|
336
|
+
Raises:
|
|
337
|
+
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
338
|
+
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
339
|
+
|
|
340
|
+
Examples:
|
|
341
|
+
>>> from meilisearch_python_sdk import AsyncClient
|
|
342
|
+
>>> from meilisearch_python_sdk.models.webhook import WebhookUpdate
|
|
343
|
+
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
344
|
+
>>> webhook_update = WebhookUpdate(url="https://example.com/new-webhook")
|
|
345
|
+
>>> webhook = await client.update_webhook("abc-123", webhook_update)
|
|
346
|
+
"""
|
|
347
|
+
response = await self._http_requests.patch(
|
|
348
|
+
f"webhooks/{uuid}", webhook.model_dump(by_alias=True, exclude_none=True)
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
return Webhook(**response.json())
|
|
352
|
+
|
|
353
|
+
async def delete_webhook(self, uuid: str) -> int:
|
|
354
|
+
"""Delete a webhook.
|
|
355
|
+
|
|
356
|
+
Args:
|
|
357
|
+
uuid: The webhook's unique identifier.
|
|
358
|
+
|
|
359
|
+
Returns:
|
|
360
|
+
The Response status code. 204 signifies a successful delete.
|
|
361
|
+
|
|
362
|
+
Raises:
|
|
363
|
+
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
364
|
+
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
365
|
+
|
|
366
|
+
Examples:
|
|
367
|
+
>>> from meilisearch_python_sdk import AsyncClient
|
|
368
|
+
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
369
|
+
>>> await client.delete_webhook("abc-123")
|
|
370
|
+
"""
|
|
371
|
+
response = await self._http_requests.delete(f"webhooks/{uuid}")
|
|
372
|
+
return response.status_code
|
|
373
|
+
|
|
255
374
|
async def create_dump(self) -> TaskInfo:
|
|
256
375
|
"""Trigger the creation of a Meilisearch dump.
|
|
257
376
|
|
|
@@ -1229,6 +1348,124 @@ class Client(BaseClient):
|
|
|
1229
1348
|
|
|
1230
1349
|
return Network(**response.json())
|
|
1231
1350
|
|
|
1351
|
+
def get_webhooks(self) -> Webhooks:
|
|
1352
|
+
"""Get all webhooks.
|
|
1353
|
+
|
|
1354
|
+
Returns:
|
|
1355
|
+
An instance of Webhooks containing all configured webhooks.
|
|
1356
|
+
|
|
1357
|
+
Raises:
|
|
1358
|
+
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1359
|
+
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1360
|
+
|
|
1361
|
+
Examples:
|
|
1362
|
+
>>> from meilisearch_python_sdk import Client
|
|
1363
|
+
>>> client = Client("http://localhost.com", "masterKey")
|
|
1364
|
+
>>> webhooks = client.get_webhooks()
|
|
1365
|
+
"""
|
|
1366
|
+
response = self._http_requests.get("webhooks")
|
|
1367
|
+
|
|
1368
|
+
return Webhooks(**response.json())
|
|
1369
|
+
|
|
1370
|
+
def get_webhook(self, uuid: str) -> Webhook:
|
|
1371
|
+
"""Get a specific webhook by UUID.
|
|
1372
|
+
|
|
1373
|
+
Args:
|
|
1374
|
+
uuid: The webhook's unique identifier.
|
|
1375
|
+
|
|
1376
|
+
Returns:
|
|
1377
|
+
An instance of Webhook containing the webhook information.
|
|
1378
|
+
|
|
1379
|
+
Raises:
|
|
1380
|
+
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1381
|
+
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1382
|
+
|
|
1383
|
+
Examples:
|
|
1384
|
+
>>> from meilisearch_python_sdk import Client
|
|
1385
|
+
>>> client = Client("http://localhost.com", "masterKey")
|
|
1386
|
+
>>> webhook = client.get_webhook("abc-123")
|
|
1387
|
+
"""
|
|
1388
|
+
response = self._http_requests.get(f"webhooks/{uuid}")
|
|
1389
|
+
|
|
1390
|
+
return Webhook(**response.json())
|
|
1391
|
+
|
|
1392
|
+
def create_webhook(self, webhook: WebhookCreate) -> Webhook:
|
|
1393
|
+
"""Create a new webhook.
|
|
1394
|
+
|
|
1395
|
+
Args:
|
|
1396
|
+
webhook: The webhook configuration to create.
|
|
1397
|
+
|
|
1398
|
+
Returns:
|
|
1399
|
+
The created webhook.
|
|
1400
|
+
|
|
1401
|
+
Raises:
|
|
1402
|
+
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1403
|
+
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1404
|
+
|
|
1405
|
+
Examples:
|
|
1406
|
+
>>> from meilisearch_python_sdk import Client
|
|
1407
|
+
>>> from meilisearch_python_sdk.models.webhook import WebhookCreate
|
|
1408
|
+
>>> client = Client("http://localhost.com", "masterKey")
|
|
1409
|
+
>>> webhook_config = WebhookCreate(
|
|
1410
|
+
>>> url="https://example.com/webhook",
|
|
1411
|
+
>>> headers={"Authorization": "Bearer token"}
|
|
1412
|
+
>>> )
|
|
1413
|
+
>>> webhook = client.create_webhook(webhook_config)
|
|
1414
|
+
"""
|
|
1415
|
+
response = self._http_requests.post(
|
|
1416
|
+
"webhooks", webhook.model_dump(by_alias=True, exclude_none=True)
|
|
1417
|
+
)
|
|
1418
|
+
|
|
1419
|
+
return Webhook(**response.json())
|
|
1420
|
+
|
|
1421
|
+
def update_webhook(self, *, uuid: str, webhook: WebhookUpdate) -> Webhook:
|
|
1422
|
+
"""Update an existing webhook.
|
|
1423
|
+
|
|
1424
|
+
Args:
|
|
1425
|
+
uuid: The webhook's unique identifier.
|
|
1426
|
+
webhook: The webhook configuration updates.
|
|
1427
|
+
|
|
1428
|
+
Returns:
|
|
1429
|
+
The updated webhook.
|
|
1430
|
+
|
|
1431
|
+
Raises:
|
|
1432
|
+
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1433
|
+
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1434
|
+
|
|
1435
|
+
Examples:
|
|
1436
|
+
>>> from meilisearch_python_sdk import Client
|
|
1437
|
+
>>> from meilisearch_python_sdk.models.webhook import WebhookUpdate
|
|
1438
|
+
>>> client = Client("http://localhost.com", "masterKey")
|
|
1439
|
+
>>> webhook_update = WebhookUpdate(url="https://example.com/new-webhook")
|
|
1440
|
+
>>> webhook = client.update_webhook("abc-123", webhook_update)
|
|
1441
|
+
"""
|
|
1442
|
+
response = self._http_requests.patch(
|
|
1443
|
+
f"webhooks/{uuid}", webhook.model_dump(by_alias=True, exclude_none=True)
|
|
1444
|
+
)
|
|
1445
|
+
|
|
1446
|
+
return Webhook(**response.json())
|
|
1447
|
+
|
|
1448
|
+
def delete_webhook(self, uuid: str) -> int:
|
|
1449
|
+
"""Delete a webhook.
|
|
1450
|
+
|
|
1451
|
+
Args:
|
|
1452
|
+
uuid: The webhook's unique identifier.
|
|
1453
|
+
|
|
1454
|
+
Returns:
|
|
1455
|
+
The Response status code. 204 signifies a successful delete.
|
|
1456
|
+
|
|
1457
|
+
Raises:
|
|
1458
|
+
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1459
|
+
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1460
|
+
|
|
1461
|
+
Examples:
|
|
1462
|
+
>>> from meilisearch_python_sdk import Client
|
|
1463
|
+
>>> client = Client("http://localhost.com", "masterKey")
|
|
1464
|
+
>>> client.delete_webhook("abc-123")
|
|
1465
|
+
"""
|
|
1466
|
+
response = self._http_requests.delete(f"webhooks/{uuid}")
|
|
1467
|
+
return response.status_code
|
|
1468
|
+
|
|
1232
1469
|
def create_dump(self) -> TaskInfo:
|
|
1233
1470
|
"""Trigger the creation of a Meilisearch dump.
|
|
1234
1471
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "4.11.0"
|
{meilisearch_python_sdk-4.10.0 → meilisearch_python_sdk-4.11.0}/meilisearch_python_sdk/index.py
RENAMED
|
@@ -3593,7 +3593,7 @@ class AsyncIndex(_BaseIndex):
|
|
|
3593
3593
|
|
|
3594
3594
|
return TaskInfo(**response.json())
|
|
3595
3595
|
|
|
3596
|
-
async def get_filterable_attributes(self) -> list[str
|
|
3596
|
+
async def get_filterable_attributes(self) -> list[str | FilterableAttributes] | None:
|
|
3597
3597
|
"""Get filterable attributes of the index.
|
|
3598
3598
|
|
|
3599
3599
|
Returns:
|
|
@@ -3616,22 +3616,22 @@ class AsyncIndex(_BaseIndex):
|
|
|
3616
3616
|
|
|
3617
3617
|
response_json = response.json()
|
|
3618
3618
|
|
|
3619
|
-
|
|
3620
|
-
return response_json
|
|
3621
|
-
|
|
3622
|
-
filterable_attributes = []
|
|
3619
|
+
filterable_attributes: list[str | FilterableAttributes] = []
|
|
3623
3620
|
for r in response_json:
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3621
|
+
if isinstance(r, str):
|
|
3622
|
+
filterable_attributes.append(r)
|
|
3623
|
+
else:
|
|
3624
|
+
filterable_attributes.append(
|
|
3625
|
+
FilterableAttributes(
|
|
3626
|
+
attribute_patterns=r["attributePatterns"],
|
|
3627
|
+
features=FilterableAttributeFeatures(**r["features"]),
|
|
3628
|
+
)
|
|
3628
3629
|
)
|
|
3629
|
-
)
|
|
3630
3630
|
|
|
3631
3631
|
return filterable_attributes
|
|
3632
3632
|
|
|
3633
3633
|
async def update_filterable_attributes(
|
|
3634
|
-
self, body: list[str
|
|
3634
|
+
self, body: list[str | FilterableAttributes], *, compress: bool = False
|
|
3635
3635
|
) -> TaskInfo:
|
|
3636
3636
|
"""Update filterable attributes of the index.
|
|
3637
3637
|
|
|
@@ -7224,7 +7224,7 @@ class Index(_BaseIndex):
|
|
|
7224
7224
|
|
|
7225
7225
|
return TaskInfo(**response.json())
|
|
7226
7226
|
|
|
7227
|
-
def get_filterable_attributes(self) -> list[str
|
|
7227
|
+
def get_filterable_attributes(self) -> list[str | FilterableAttributes] | None:
|
|
7228
7228
|
"""Get filterable attributes of the index.
|
|
7229
7229
|
|
|
7230
7230
|
Returns:
|
|
@@ -7247,22 +7247,22 @@ class Index(_BaseIndex):
|
|
|
7247
7247
|
|
|
7248
7248
|
response_json = response.json()
|
|
7249
7249
|
|
|
7250
|
-
|
|
7251
|
-
return response_json
|
|
7252
|
-
|
|
7253
|
-
filterable_attributes = []
|
|
7250
|
+
filterable_attributes: list[str | FilterableAttributes] = []
|
|
7254
7251
|
for r in response_json:
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7252
|
+
if isinstance(r, str):
|
|
7253
|
+
filterable_attributes.append(r)
|
|
7254
|
+
else:
|
|
7255
|
+
filterable_attributes.append(
|
|
7256
|
+
FilterableAttributes(
|
|
7257
|
+
attribute_patterns=r["attributePatterns"],
|
|
7258
|
+
features=FilterableAttributeFeatures(**r["features"]),
|
|
7259
|
+
)
|
|
7259
7260
|
)
|
|
7260
|
-
)
|
|
7261
7261
|
|
|
7262
7262
|
return filterable_attributes
|
|
7263
7263
|
|
|
7264
7264
|
def update_filterable_attributes(
|
|
7265
|
-
self, body: list[str
|
|
7265
|
+
self, body: list[str | FilterableAttributes], *, compress: bool = False
|
|
7266
7266
|
) -> TaskInfo:
|
|
7267
7267
|
"""Update filterable attributes of the index.
|
|
7268
7268
|
|
|
@@ -167,7 +167,7 @@ class MeilisearchSettings(CamelBase):
|
|
|
167
167
|
synonyms: JsonDict | None = None
|
|
168
168
|
stop_words: list[str] | None = None
|
|
169
169
|
ranking_rules: list[str] | None = None
|
|
170
|
-
filterable_attributes: list[str
|
|
170
|
+
filterable_attributes: list[str | FilterableAttributes] | None = None
|
|
171
171
|
distinct_attribute: str | None = None
|
|
172
172
|
searchable_attributes: list[str] | None = None
|
|
173
173
|
displayed_attributes: list[str] | None = None
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from camel_converter.pydantic_base import CamelBase
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Webhook(CamelBase):
|
|
7
|
+
uuid: str
|
|
8
|
+
url: str
|
|
9
|
+
headers: dict[str, str] | None = None
|
|
10
|
+
is_editable: bool
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Webhooks(CamelBase):
|
|
14
|
+
results: list[Webhook]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class WebhookCreate(CamelBase):
|
|
18
|
+
url: str
|
|
19
|
+
headers: dict[str, str] | None = None
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class WebhookUpdate(CamelBase):
|
|
23
|
+
url: str | None = None
|
|
24
|
+
headers: dict[str, str] | None = None
|
|
@@ -41,15 +41,15 @@ all = ["orjson", "ujson"]
|
|
|
41
41
|
[dependency-groups]
|
|
42
42
|
dev = [
|
|
43
43
|
"mkdocs==1.6.1",
|
|
44
|
-
"mkdocs-material==9.6.
|
|
45
|
-
"mkdocstrings[python]==0.30.
|
|
46
|
-
"mypy[faster-cache]==1.18.
|
|
44
|
+
"mkdocs-material==9.6.21",
|
|
45
|
+
"mkdocstrings[python]==0.30.1",
|
|
46
|
+
"mypy[faster-cache]==1.18.2",
|
|
47
47
|
"pre-commit==4.3.0",
|
|
48
48
|
"pytest==8.4.2",
|
|
49
49
|
"pytest-cov==7.0.0",
|
|
50
50
|
"pytest-asyncio==1.2.0",
|
|
51
51
|
"pytest-xdist==3.8.0",
|
|
52
|
-
"ruff==0.13.
|
|
52
|
+
"ruff==0.13.3",
|
|
53
53
|
"types-aiofiles==24.1.0.20250822",
|
|
54
54
|
"typing-extensions==4.15.0",
|
|
55
55
|
"types-ujson==5.10.0.20250822",
|
|
@@ -18,6 +18,7 @@ from httpx import AsyncClient as HttpxAsyncClient
|
|
|
18
18
|
|
|
19
19
|
from meilisearch_python_sdk import AsyncClient, Client
|
|
20
20
|
from meilisearch_python_sdk._task import async_wait_for_task, wait_for_task
|
|
21
|
+
from meilisearch_python_sdk.errors import MeilisearchApiError
|
|
21
22
|
from meilisearch_python_sdk.json_handler import OrjsonHandler, UjsonHandler
|
|
22
23
|
from meilisearch_python_sdk.models.settings import (
|
|
23
24
|
Embedders,
|
|
@@ -29,6 +30,7 @@ from meilisearch_python_sdk.models.settings import (
|
|
|
29
30
|
TypoTolerance,
|
|
30
31
|
UserProvidedEmbedder,
|
|
31
32
|
)
|
|
33
|
+
from meilisearch_python_sdk.models.webhook import WebhookCreate
|
|
32
34
|
|
|
33
35
|
MASTER_KEY = "masterKey"
|
|
34
36
|
|
|
@@ -353,3 +355,17 @@ def new_settings_localized():
|
|
|
353
355
|
LocalizedAttributes(locales=["ita"], attribute_patterns=["*_it"]),
|
|
354
356
|
],
|
|
355
357
|
)
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
@pytest.fixture
|
|
361
|
+
def webhook(client):
|
|
362
|
+
webhook_config = WebhookCreate(url="https://example.com/webhook")
|
|
363
|
+
webhook = client.create_webhook(webhook_config)
|
|
364
|
+
|
|
365
|
+
yield webhook
|
|
366
|
+
|
|
367
|
+
try:
|
|
368
|
+
client.delete_webhook(webhook.uuid)
|
|
369
|
+
except MeilisearchApiError as e:
|
|
370
|
+
if "webhook_not_found" in str(e):
|
|
371
|
+
pass
|
|
@@ -25,6 +25,7 @@ from meilisearch_python_sdk.errors import (
|
|
|
25
25
|
from meilisearch_python_sdk.models.client import KeyCreate, KeyUpdate, Network
|
|
26
26
|
from meilisearch_python_sdk.models.index import IndexInfo
|
|
27
27
|
from meilisearch_python_sdk.models.version import Version
|
|
28
|
+
from meilisearch_python_sdk.models.webhook import WebhookCreate, WebhookUpdate
|
|
28
29
|
from meilisearch_python_sdk.types import JsonDict
|
|
29
30
|
|
|
30
31
|
|
|
@@ -1085,3 +1086,48 @@ async def test_add_or_update_networks(async_client):
|
|
|
1085
1086
|
assert len(response.remotes) >= 2
|
|
1086
1087
|
assert "remote_1" in response.remotes
|
|
1087
1088
|
assert "remote_2" in response.remotes
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
async def test_get_webhooks(async_client, webhook):
|
|
1092
|
+
response = await async_client.get_webhooks()
|
|
1093
|
+
|
|
1094
|
+
assert response.results is not None
|
|
1095
|
+
assert webhook in response.results
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
async def test_create_webhook(async_client):
|
|
1099
|
+
webhook_config = WebhookCreate(
|
|
1100
|
+
url="https://example.com/webhook", headers={"Authorization": "Bearer token"}
|
|
1101
|
+
)
|
|
1102
|
+
webhook = await async_client.create_webhook(webhook_config)
|
|
1103
|
+
|
|
1104
|
+
try:
|
|
1105
|
+
assert webhook.uuid is not None
|
|
1106
|
+
assert webhook.url == "https://example.com/webhook"
|
|
1107
|
+
assert webhook.headers == {"Authorization": "Bearer token"}
|
|
1108
|
+
assert webhook.is_editable is True
|
|
1109
|
+
finally:
|
|
1110
|
+
await async_client.delete_webhook(webhook.uuid)
|
|
1111
|
+
|
|
1112
|
+
|
|
1113
|
+
async def test_get_webhook(async_client, webhook):
|
|
1114
|
+
result = await async_client.get_webhook(webhook.uuid)
|
|
1115
|
+
|
|
1116
|
+
assert result.uuid == webhook.uuid
|
|
1117
|
+
assert result.url == webhook.url
|
|
1118
|
+
assert result.is_editable == webhook.is_editable
|
|
1119
|
+
|
|
1120
|
+
|
|
1121
|
+
async def test_update_webhook(async_client, webhook):
|
|
1122
|
+
update = WebhookUpdate(url="https://example.com/new-webhook", headers={"X-Custom": "value"})
|
|
1123
|
+
updated = await async_client.update_webhook(uuid=webhook.uuid, webhook=update)
|
|
1124
|
+
|
|
1125
|
+
assert updated.uuid == webhook.uuid
|
|
1126
|
+
assert updated.url == "https://example.com/new-webhook"
|
|
1127
|
+
assert updated.headers == {"X-Custom": "value"}
|
|
1128
|
+
|
|
1129
|
+
|
|
1130
|
+
async def test_delete_webhook(async_client, webhook):
|
|
1131
|
+
status_code = await async_client.delete_webhook(webhook.uuid)
|
|
1132
|
+
|
|
1133
|
+
assert status_code == 204
|
|
@@ -586,6 +586,7 @@ async def test_get_filterable_attributes(async_empty_index):
|
|
|
586
586
|
facet_search=True, filter=Filter(equality=True, comparison=False)
|
|
587
587
|
),
|
|
588
588
|
),
|
|
589
|
+
"genre",
|
|
589
590
|
],
|
|
590
591
|
),
|
|
591
592
|
)
|
|
@@ -594,7 +595,7 @@ async def test_update_filterable_attributes(compress, async_empty_index, filtera
|
|
|
594
595
|
response = await index.update_filterable_attributes(filterable_attributes, compress=compress)
|
|
595
596
|
await async_wait_for_task(index.http_client, response.task_uid)
|
|
596
597
|
response = await index.get_filterable_attributes()
|
|
597
|
-
assert
|
|
598
|
+
assert response == filterable_attributes
|
|
598
599
|
|
|
599
600
|
|
|
600
601
|
@pytest.mark.parametrize(
|
|
@@ -22,6 +22,7 @@ from meilisearch_python_sdk.errors import (
|
|
|
22
22
|
from meilisearch_python_sdk.models.client import KeyCreate, KeyUpdate, Network
|
|
23
23
|
from meilisearch_python_sdk.models.index import IndexInfo
|
|
24
24
|
from meilisearch_python_sdk.models.version import Version
|
|
25
|
+
from meilisearch_python_sdk.models.webhook import WebhookCreate, WebhookUpdate
|
|
25
26
|
from meilisearch_python_sdk.types import JsonDict
|
|
26
27
|
|
|
27
28
|
|
|
@@ -1066,3 +1067,48 @@ def test_add_or_update_networks(client):
|
|
|
1066
1067
|
assert len(response.remotes) >= 2
|
|
1067
1068
|
assert "remote_1" in response.remotes
|
|
1068
1069
|
assert "remote_2" in response.remotes
|
|
1070
|
+
|
|
1071
|
+
|
|
1072
|
+
def test_get_webhooks(client, webhook):
|
|
1073
|
+
response = client.get_webhooks()
|
|
1074
|
+
|
|
1075
|
+
assert response.results is not None
|
|
1076
|
+
assert webhook in response.results
|
|
1077
|
+
|
|
1078
|
+
|
|
1079
|
+
def test_create_webhook(client):
|
|
1080
|
+
webhook_config = WebhookCreate(
|
|
1081
|
+
url="https://example.com/webhook", headers={"Authorization": "Bearer token"}
|
|
1082
|
+
)
|
|
1083
|
+
webhook = client.create_webhook(webhook_config)
|
|
1084
|
+
|
|
1085
|
+
try:
|
|
1086
|
+
assert webhook.uuid is not None
|
|
1087
|
+
assert webhook.url == "https://example.com/webhook"
|
|
1088
|
+
assert webhook.headers == {"Authorization": "Bearer token"}
|
|
1089
|
+
assert webhook.is_editable is True
|
|
1090
|
+
finally:
|
|
1091
|
+
client.delete_webhook(webhook.uuid)
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
def test_get_webhook(client, webhook):
|
|
1095
|
+
result = client.get_webhook(webhook.uuid)
|
|
1096
|
+
|
|
1097
|
+
assert result.uuid == webhook.uuid
|
|
1098
|
+
assert result.url == webhook.url
|
|
1099
|
+
assert result.is_editable == webhook.is_editable
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
def test_update_webhook(client, webhook):
|
|
1103
|
+
update = WebhookUpdate(url="https://example.com/new-webhook", headers={"X-Custom": "value"})
|
|
1104
|
+
updated = client.update_webhook(uuid=webhook.uuid, webhook=update)
|
|
1105
|
+
|
|
1106
|
+
assert updated.uuid == webhook.uuid
|
|
1107
|
+
assert updated.url == "https://example.com/new-webhook"
|
|
1108
|
+
assert updated.headers == {"X-Custom": "value"}
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
def test_delete_webhook(client, webhook):
|
|
1112
|
+
status_code = client.delete_webhook(webhook.uuid)
|
|
1113
|
+
|
|
1114
|
+
assert status_code == 204
|
|
@@ -574,6 +574,7 @@ def test_get_filterable_attributes(empty_index):
|
|
|
574
574
|
facet_search=True, filter=Filter(equality=True, comparison=False)
|
|
575
575
|
),
|
|
576
576
|
),
|
|
577
|
+
"genre",
|
|
577
578
|
],
|
|
578
579
|
),
|
|
579
580
|
)
|
|
@@ -582,7 +583,7 @@ def test_update_filterable_attributes(compress, empty_index, filterable_attribut
|
|
|
582
583
|
response = index.update_filterable_attributes(filterable_attributes, compress=compress)
|
|
583
584
|
wait_for_task(index.http_client, response.task_uid)
|
|
584
585
|
response = index.get_filterable_attributes()
|
|
585
|
-
assert
|
|
586
|
+
assert response == filterable_attributes
|
|
586
587
|
|
|
587
588
|
|
|
588
589
|
@pytest.mark.parametrize(
|