Skip to content

Commit 2b45c8d

Browse files
committed
Fix deserialization error when retrieving tasks and none are present
This should be rare, but if there are no tasks at all the server returns null for from in the tasks, but only an int was allowed before.
1 parent 68f90ab commit 2b45c8d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

meilisearch_python_sdk/index.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8261,7 +8261,7 @@ async def _async_load_documents_from_file(
82618261
and not csv_delimiter.isascii()
82628262
):
82638263
raise ValueError("csv_delimiter must be a single ascii character")
8264-
with open(file_path) as f: # noqa: ASYNC101 ASYNC230
8264+
with open(file_path) as f: # noqa: ASYNC230
82658265
if csv_delimiter:
82668266
documents = await loop.run_in_executor(
82678267
None, partial(DictReader, f, delimiter=csv_delimiter)
@@ -8271,7 +8271,7 @@ async def _async_load_documents_from_file(
82718271
return list(documents)
82728272

82738273
if file_path.suffix == ".ndjson":
8274-
with open(file_path) as f: # noqa: ASYNC101 ASYNC230
8274+
with open(file_path) as f: # noqa: ASYNC230
82758275
return [await loop.run_in_executor(None, partial(json_handler.loads, x)) for x in f]
82768276

82778277
async with aiofiles.open(file_path) as f: # type: ignore

meilisearch_python_sdk/models/task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class TaskStatus(CamelBase):
5252
results: list[TaskResult]
5353
total: int
5454
limit: int
55-
from_: int = Field(..., alias="from")
55+
from_: int | None = Field(None, alias="from")
5656
next: int | None = None
5757

5858

0 commit comments

Comments
 (0)