コード例 #1
0
ファイル: report.py プロジェクト: gwmoura/trello-reports
def get_cards(borad_id):
    board = Boards(TRELLO_APP_KEY, TRELLO_APP_TOKEN)
    cards = board.get_card(borad_id, filter={'closed'})
    return cards
コード例 #2
0
from trello import Boards
from trello import Members
import unicodedata


def norm(dataunicode):
    return unicodedata.normalize('NFKD', dataunicode).encode('ascii', 'ignore')


KEY = '5869b53180c8e5a19ae1e9a9d2d94916'
TOKEN = 'a6c38225f99c5e4cf6ad8c4fc8149a1af77552c0d3f54cf367089f2255d451b3'
BOARD_ID = '5af5977d264baece554c3fec'  # DESENV

membros = Members(KEY, TOKEN)
boards = Boards(KEY, TOKEN)
cards = boards.get_card(BOARD_ID)

cabecalho = 'nome_tarefa' + ';' + 'responsavel' + ';' + 'labels' + ';' + 'data' + ';' + 'feito'
print(cabecalho)
for i in cards:
    if len(i[u'idMembers']) > 0:
        dono = membros.get(i[u'idMembers'][0])
        nome_dono = dono[u'username']
    else:
        nome_dono = 'Sem dono'
    lista_labels = ''
    if len(i[u'labels']) > 0:
        for j in i[u'labels']:
            lista_labels = lista_labels + '|' + j[u'name']
    if i[u'due']:
        data = '' + i[u'due']
コード例 #3
0
# token given by website
auth_token = "744be46a0777522b10e26f42a819274dcbdc490bfc6d927960dc555d0fdb94b7"
trello.set_token(auth_token)

cards = Cards(app_key, auth_token)
boards = Boards(app_key, auth_token)

cardIds = []  # empty list where we will store card ID's
label_names = []  # empty list where we will store unmodified label names
label_names_lc = []  # empty list where we will store lowercase label names

print(
    "\nList of cards, their respective ID's, and their respective label names:"
)

for x in range(0, len(boards.get_card(boardId))):  # 0 to 9, because 10 cards
    y = boards.get_card(boardId)[x]  # get every individual card's info
    card = y["name"]  # get card's description
    card_id = y["shortLink"]  # get card's ID
    # exception handling: some cards have no label whatsoever, so the "name" key doesn't exist in the "label section"
    try:
        label = cards.get(card_id)["labels"][0]["name"]  # get label name
        # "labels" in the JSON essentially consists of 1 library constaining a few (key, value) pairs. That's why index = 0
    except IndexError:
        label = ""
    print("%-34s || %-5s || %14s" % (card, card_id, label))  # formatting
    cardIds.append(card_id)  # add card ID's to list
    if label != "":  # if label doesn't have a name, don't do anything with it
        label_names.append(label)  # add label names to list
        label_names_lc.append(
            label.lower())  # add lowercase label names to list