Package: python-clickup
PyClickupPyClickup - little Python library that gives you the opportunity to wrap your ClickUp lists into Python classes. It will give an ability to manipulate (get/create/update) list's data easily.The greatest benefit of using this library is that you do not need to think about parsing ClickUp's custom fields on your own. All you need to do is to initialize your custom class with all the required fields (see example below).InitializationAll you need to do is to install the library with your package managerpip install python-clickupGetting Started1. ClickUp authFirst, you must provide aCLICKUP_AUTH_TOKENenvironmental variable. You can get your token in yours ClickUp space settings (ClickUp > Settings > My Apps)After settingCLICKUP_AUTH_TOKEN, you are ready to create your wrappers.2. ClickUp Space exampleLet's create a little ClickUp space with following hierarchyHere is the structure ofEmployeestaskand here isUnitstask3. Create List wrappersTo create wrappers for your lists, you need to do the following steps:Create your list class as subclass ofClickUpListclassAddLIST_IDclass variable to your class. (How to get LIST_ID?)Add required custom fields. Notice, that it is not required to set all the fields from your ClickUp list. You are free to add only useful custom fields.Here is the example of wrappers that we can create for example space hierarchyfrompyclickupimportClickUpListfrompyclickup.custom_fieldsimport*classEmployees(ClickUpList):LIST_ID=<employeeslistidasint>first_name=ShortTextField(field_name="First Name")last_name=ShortTextField(field_name="Last Name")address=LocationField(field_name="Address")salary=CurrencyField(field_name="Current Salary")birth_date=DateField(field_name="Date of Birth")need_raise=CheckboxField(field_name="Need a raise?")# Relationsunits=RelationField("Units",field_name="Units")classUnits(ClickUpList):LIST_ID=<unitslistidasint>address=LocationField(field_name="Address")# Relationsemployees=RelationField("Employees",field_name="Employees")As you can see from the example, we have defined 2 classes that represents the structure of our ClickUp Lists. Let's have a closer look at how we define the custom fields for the lists. All the custom fields requiredfield_namefield that represents the name of the field in your list. Besides,RelationFieldrequires additional field that stays forname of custom listthat you like to relate with.4. Usage# Get employeeemployee=Employees()# Empty employeeemployee=Employees.get_by_id("2hravjh")employee=Employees.get_by_name("Sherlock Holmes")# Get default attributesemployee.id# 2hravjhemployee.name# "Sherlock Holmes"employee.description# "Great detective"employee.url# "https://app.clickup.com/t/2hravjh"employee.status# "To do"# Set new datafromdatetimeimportdatetimeemployee.first_name="Marry"employee.last_name="Sue"employee.address="Some new valid address"employee.salary=1000employee.birth_date=datetime(1,1,2022)employee.need_raise=Falseemployee.update()# To update existed employee (employee.id MUST be provided)employee.create()# To create new employee# Adding relationsunit=Units.get_by_name("Unit 1")employee.units=unit# `unit` MUST be type `Units` as we defined in Employees.units fieldemployee.update()# ORunit.employees=employeeunit.update()This example does not include all the CustomFields. You can get the list of all the valid fields inpyclickup.custom_fieldsfolder.FAQHow to get LIST_ID?Click on menu button on your list and clickCopy linkPaste link somewhere and extract theLIST_ID