Skip to content

client.get_batch_v2() is failing with Pydantic "Input should be a valid string" and "Input should be a valid list" errors #231

Description

@DougX71

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of pyticktick.

Reproducible example

import json
from pyticktick import Client

client = Client(v2_username="username", v2_password="password")
resp = client.get_batch_v2()

print("My Projects:")
for project in resp.project_profiles:
    print(json.dumps(project.model_dump(mode="json"), indent=4))

print("My Tasks:")
for task in resp.sync_task_bean.update:
    print(json.dumps(task.model_dump(mode="json"), indent=4))

Log output

Connected to pydev debugger (build 221.5080.212)
2025-12-18 11:50:41.450 | WARNING  | pyticktick.settings:_get_v1_token:512 - Cannot signon to v1 without `v1_client_id` and `v1_client_secret`
I:\Inspiron copy\Doug\TickTickAPIUsage\venv\lib\site-packages\pyticktick\settings.py:513: UserWarning: Cannot signon to v1 without `v1_client_id` and `v1_client_secret`
  warnings.warn(msg, UserWarning, stacklevel=1)
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2022.1\plugins\python-ce\helpers\pydev\pydevd.py", line 1491, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2022.1\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "I:/Inspiron copy/Doug/TickTickAPIUsage/pytt_get_projects_and_tasks_from_test_account_V2.py", line 13, in <module>
    resp = client.get_batch_v2()
  File "I:\Inspiron copy\Doug\TickTickAPIUsage\venv\lib\site-packages\pyticktick\client.py", line 1219, in get_batch_v2
    return GetBatchV2.model_validate(resp)
  File "I:\Inspiron copy\Doug\TickTickAPIUsage\venv\lib\site-packages\pydantic\main.py", line 716, in model_validate
    return cls.__pydantic_validator__.validate_python(
pydantic_core._pydantic_core.ValidationError: 2 validation errors for GetBatchV2
inboxId
  Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.12/v/string_type
projectProfiles
  Input should be a valid list [type=list_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.12/v/list_type
python-BaseException

Issue description

The client authorization is now working with the upgrade to 0.3.0, but the line resp = client.get_batch_v2() is generating Pydantic errors.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions