I am using clickuppython to call clickup API. When I set Priority in Clickup dashboard (e.g. High), I get this error
# Example request | Creating a task in a list
c = client.ClickUpClient(API_KEY)
tasks = c.get_tasks(self.list_id, include_closed=True)
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. from the documentation, it should be:
Setting priority
priority is a number that corresponds to the Priorities available in the ClickUp UI. As in the ClickUp UI, priorities cannot be customized. 1 is Urgent 2 is High 3 is Normal 4 is Low
So what is the solution?
According to the official Clickup documentation for tasks,
I am not familiar with that Python library in particular, but it appears you might have to pass one of these integers when setting priority rather than a string. Let me know if this works.