clickupython icon indicating copy to clipboard operation
clickupython copied to clipboard

Priority is not integer

Open omiderfanmanesh opened this issue 1 year ago • 3 comments

When I set Priority in Clickup dashboard (e.g. High), I get this error

Traceback (most recent call last):
  File "C:\PROJECT\Clickup\main.py", line 29, in main
    click_up_client.fetch_data()
  File "C:\PROJECT\Clickup\request_manager\clickup\client.py", line 40, in fetch_data
    tasks = c.get_tasks(self.list_id, include_closed=True)
  File "C:\Users\x\.conda\envs\general\lib\site-packages\clickupython\client.py", line 631, in get_tasks
    return models.Tasks.build_tasks(fetched_tasks)
  File "C:\Users\x\.conda\envs\general\lib\site-packages\clickupython\models.py", line 703, in build_tasks
    return Tasks(**self)
  File "pydantic\main.py", line 406, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for Tasks
tasks -> 2 -> priority
  value is not a valid integer (type=type_error.integer)

This is a part of the result as json from postman and clickup api


          "watchers": [],
            "checklists": [],
            "tags": [],
            "parent": null,
            "priority": {
                "color": "#f8ae00",
                "id": "2",
                "orderindex": "2",
                "priority": "high"
            },

as you see, the Priority is a JSON object, not an int.

So what is the solution?

omiderfanmanesh avatar Jan 08 '24 16:01 omiderfanmanesh

Got the same issue here. image

Tianqi-Dotes avatar Jan 29 '24 15:01 Tianqi-Dotes

Had the same issue. Needed to work on the client.py and models.py and did the following changes manually on my venv:

  1. in client.py, replaced all 'priority: int = None' to 'priority: str = None' and 'priority: int' to 'priority: str'
  2. in models.py, replaced the 'priority: Any = None' to 'priority: str = None', 'priority: Any' to 'priority: str' and in the Task Class 'priority: Optional[Any] = None' to 'priority: Optional[Priority] = None'

In my program I had to update the code to use the objects correctly and now I have a syncer that gets tasks from Jira down to Clickup without any issue.

nikpelgr avatar Feb 12 '24 21:02 nikpelgr

had the same issue. Anyone willing to fork this and update it?

starascendin avatar Dec 28 '24 22:12 starascendin