Ejemplo n.º 1
0
def clear_board(board: trello.Board):
    for list in board.get_lists('all'):
        list.archive_all_cards()
        list.close()

    preexisting_labels = board.get_labels()
    if preexisting_labels:
        for label in preexisting_labels:
            board.delete_label(label.id)
Ejemplo n.º 2
0
def get_list(name: str, board: trello.Board) -> trello.List:
    """
    Find  an open Trello list of the specified name
    :param name: The name of the list
    :param board: The board
    :return: The list
    """
    for trello_list in board.get_lists('open'):
        if trello_list.name == name:
            return trello_list
    return None
Ejemplo n.º 3
0
def archive_cards(board_name="Private", list_name="Done", days=1):
    """ archive cards """
    username, key, token = util.get_credential()

    client = TrelloClient(key, token)

    # Get board
    boards = get_boards(username, client)
    board_id = boards[board_name]
    board = Board(board_id, client)

    # Get board
    lists = board.get_lists()
    list_done = [x for x in lists if x.name == list_name][0]
    cards = list_done.get_cards()

    target = datetime.datetime.now(pytz.utc) - datetime.timedelta(days=days)

    for card in _filter_cards(cards, target):
        card.set_closed("true")
        logger.debug(card)
Ejemplo n.º 4
0
#!/usr/bin/env PYTHONIOENCODING=UTF-8 python
# -*- coding: utf-8 -*-

from trello import TrelloClient, get_boards
from trello import Board
import util

CONFIG = "./config.cfg"

if __name__ == u"__main__":
    username, key, token = util.get_credential()

    client = TrelloClient(key, token)

    # Get "Private" board
    boards = get_boards(username, client)
    board_id = boards["Private"]
    board = Board(board_id, client)

    # Get "Doing" board
    lists = board.get_lists()

    # Get current card
    cards = lists[1].get_cards()
    try:
        print(cards[0].name)
    except:
        print("nothing :)")