Open LIPDProductionsInc opened 2 years ago
Hi, I have the same problems with finding proper documentation. However, I have solved the problem with creating cards. If my code snippet doesn't help you, let me know.
Best regards Paul
# ------------------------------------------------------------------------------
# Import Sub-Packages
# ------------------------------------------------------------------------------
from trello import TrelloApi
from datetime import datetime
from fastapi import APIRouter
# ------------------------------------------------------------------------------
# Trello API Values
# ------------------------------------------------------------------------------
KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
TOKEN = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
BACKLOG_LIST_ID = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
CARD_POS = 'top'
# ------------------------------------------------------------------------------
# Trello API Labels
# ------------------------------------------------------------------------------
GREEN = '615c0cdbec7b9d8da4b36d96'
BLUE = '615c0cdbec7b9d8da4b36da2'
YELLOW = '615c0cdbec7b9d8da4b36d99'
ORANGE = '615c0cdbec7b9d8da4b36d9b'
RED = '615c0cdbec7b9d8da4b36d9d'
PURPLE = '615c0cdbec7b9d8da4b36da0'
SKY = '6166cb2d2f24eb7f0a9ea9e7'
# ------------------------------------------------------------------------------
# Class
# ------------------------------------------------------------------------------
class TrelloFactory():
def execute(self, trello_data):
try:
trello_manager = TrelloApi(KEY, TOKEN)
ia_number_value = trello_data.ia_number
ia_name_value = trello_data.ia_name
ia_text_value = trello_data.ia_text
ia_date_value = datetime(trello_data.ia_date.year, trello_data.ia_date.month, trello_data.ia_date.day, 9, 0 ,0)
ia_label_values = []
time_between_insertion = ia_date_value - datetime.now()
if time_between_insertion.days < 7:
ia_label_values.append(SKY)
ia_label_values.append(ORANGE)
card_header = str(ia_number_value) + ' - ' + ia_name_value
card_desc_date = '\n\nUrsprüngliches Fertigstellungsdatum: ' + str(ia_date_value.strftime('%d.%m.%Y'))
card_desc_creator = f'\nIA erstellt von: {trello_data.ia_creator}'
card_desc = ia_text_value + card_desc_date + card_desc_creator
trello_manager.cards.new(card_header,
idList=BACKLOG_LIST_ID,
desc=card_desc,
idLabels=ia_label_values,
due=ia_date_value)
return True, 'None'
except Exception as e:
return False, str(e)
Is there any documentation, specifically on how to add items to the board?