trello#

class platypush.plugins.trello.TrelloPlugin(api_key: str, api_secret: str | None = None, token: str | None = None, **kwargs)[source]#

Bases: Plugin

Trello integration.

Requires:

  • py-trello (pip install py-trello)

You’ll also need a Trello API key. You can get it here <https://trello.com/app-key>. You’ll also need an auth token if you want to view/change private resources. You can generate a permanent token linked to your account on https://trello.com/1/connect?key=<KEY>&name=platypush&response_type=token&expiration=never&scope=read,write

__init__(api_key: str, api_secret: str | None = None, token: str | None = None, **kwargs)[source]#
Parameters:
  • api_key – Trello API key. You can get it here <https://trello.com/app-key>.

  • api_secret – Trello API secret. You can get it here <https://trello.com/app-key>.

  • token – Trello token. It is required if you want to access or modify private resources. You can get a permanent token on https://trello.com/1/connect?key=<KEY>&name=platypush&response_type=token&expiration=never&scope=read,write

add_card(board: str, list: str, name: str, description: str | None = None, position: int | None = None, labels: List[str] | None = None, due: datetime | str | None = None, source: str | None = None, assign: List[str] | None = None) TrelloCardResponse[source]#

Add a card to a list.

Parameters:
  • board – Board ID or name

  • list – List ID or name

  • name – Card name

  • description – Card description

  • position – Card position index

  • labels – List of labels

  • due – Due date (datetime.datetime object or ISO-format string)

  • source – Card ID to clone from

  • assign – List of assignee member IDs

add_card_member(card_id: str, member_id: str)[source]#

Add a member to a card.

Parameters:
  • card_id – Card ID

  • member_id – Member ID

add_checklist(card_id: str, title: str, items: List[str], states: List[bool] | None = None)[source]#

Add a checklist to a card.

Parameters:
  • card_id – Card ID

  • title – Checklist title

  • items – List of items in the checklist

  • states – State of each item, True for checked, False for unchecked

add_label(card_id: str, label: str)[source]#

Add a label to a card.

Parameters:
  • card_id – Card ID

  • label – Label name

add_list(board: str, name: str, pos: int | None = None)[source]#

Add a list to a board.

Parameters:
  • board – Board ID or name

  • name – List name

  • pos – Optional position (default: last)

add_member(board: str, member_id: str, member_type: str = 'normal')[source]#

Add a member to a board.

Parameters:
  • board – Board ID or name.

  • member_id – Member ID to add.

  • member_type – Member type - can be ‘normal’ or ‘admin’ (default: ‘normal’).

archive_all_cards(board: str, list: str)[source]#

Archive all the cards on a list.

Parameters:
  • board – Board ID or name

  • list – List ID or name

assign_card(card_id: str, member_id: str)[source]#

Assign a card.

Parameters:
  • card_id – Card ID

  • member_id – Member ID

attach_card(card_id: str, name: str | None = None, mime_type: str | None = None, file: str | None = None, url: str | None = None)[source]#

Add an attachment to a card. It can be either a local file or a remote URL.

Parameters:
  • card_id – Card ID

  • name – File name

  • mime_type – MIME type

  • file – Path to the file

  • url – URL to the file

card_subscribe(card_id: str)[source]#

Subscribe to a card. :param card_id: Card ID

change_card_board(card_id: str, board: str, list: str = None)[source]#

Move a card to a new board.

Parameters:
  • card_id – Card ID

  • board – New board ID or name

  • list – Optional target list ID or name

change_card_list(card_id: str, list: str)[source]#

Move a card to a new list.

Parameters:
  • card_id – Card ID

  • list – List ID or name

change_card_pos(card_id: str, position: int)[source]#

Move a card to a new position.

Parameters:
  • card_id – Card ID

  • position – New position index

close_board(board: str)[source]#

Close/archive a board.

Parameters:

board – Board ID or name

close_card(card_id: str)[source]#

Close/archive a card.

Parameters:

card_id – Card ID

close_list(board: str, list: str)[source]#

Close/archive a list.

Parameters:
  • board – Board ID or name

  • list – List ID or name

comment_card(card_id: str, text: str)[source]#

Add a comment to a card.

Parameters:
  • card_id – Card ID

  • text – Comment text

create_label(board: str, name: str, color: str | None = None)[source]#

Add a label to a board.

Parameters:
  • board – Board ID or name

  • name – Label name

  • color – Optional HTML color

delete_card(card_id: str)[source]#

Permanently delete a card.

Parameters:

card_id – Card ID

delete_comment(card_id: str, comment_id: str)[source]#

Delete a comment.

Parameters:
  • card_id – Card ID

  • comment_id – Comment ID

delete_label(board: str, label: str)[source]#

Delete a label from a board.

Parameters:
  • board – Board ID or name

  • label – Label ID or name

get_admin_members(board: str) TrelloMembersResponse[source]#

Get the list of the admin members of a board. :param board: Board ID or name.

get_board(board: str) TrelloBoardResponse[source]#

Get the info about a board.

Parameters:

board – Board ID or name

get_boards(all: bool = False) TrelloBoardsResponse[source]#

Get the list of boards.

Parameters:

all – If True, return all the boards included those that have been closed/archived/deleted. Otherwise, only return open/active boards (default: False).

get_cards(board: str, list: str | None = None, all: bool = False) TrelloCardsResponse[source]#

Get the list of cards on a board.

Parameters:
  • board – Board ID or name

  • list – List ID or name. If set then the method will only return the cards found on that list (default: None)

  • all – If True, return all the cards included those that have been closed/archived/deleted. Otherwise, only return open/active cards (default: False).

get_lists(board: str, all: bool = False) TrelloListsResponse[source]#

Get the list of lists on a board.

Parameters:
  • board – Board ID or name

  • all – If True, return all the lists, included those that have been closed/archived/deleted. Otherwise, only return open/active lists (default: False).

get_members(board: str) TrelloMembersResponse[source]#

Get the list of all the members of a board. :param board: Board ID or name.

list_subscribe(board: str, list: str)[source]#

Subscribe to a list.

Parameters:
  • board – Board ID or name

  • list – List ID or name

list_unsubscribe(board: str, list: str)[source]#

Unsubscribe from a list.

Parameters:
  • board – Board ID or name

  • list – List ID or name

move_all_cards(board: str, src: str, dest: str)[source]#

Move all the cards from a list to another.

Parameters:
  • board – Board ID or name

  • src – Source list

  • dest – Target list

move_list(board: str, list: str, position: int)[source]#

Move a list to another position.

Parameters:
  • board – Board ID or name

  • list – List ID or name

  • position – New position index

open_board(board: str)[source]#

Re-open/un-archive a board.

Parameters:

board – Board ID or name

open_card(card_id: str)[source]#

Open/un-archive a card.

Parameters:

card_id – Card ID

open_list(board: str, list: str)[source]#

Open/un-archive a list.

Parameters:
  • board – Board ID or name

  • list – List ID or name

remove_attachment(card_id: str, attachment_id: str)[source]#

Remove an attachment from a card.

Parameters:
  • card_id – Card ID

  • attachment_id – Attachment ID

remove_card_due(card_id: str)[source]#

Remove the due date from a card.

Parameters:

card_id – Card ID

remove_card_due_complete(card_id: str)[source]#

Remove the due complete flag from a card.

Parameters:

card_id – Card ID

remove_card_member(card_id: str, member_id: str)[source]#

Remove a member from a card.

Parameters:
  • card_id – Card ID

  • member_id – Member ID

remove_label(card_id: str, label: str)[source]#

Remove a label from a card.

Parameters:
  • card_id – Card ID

  • label – Label name

remove_member(board: str, member_id: str)[source]#

Remove a member from a board.

Parameters:
  • board – Board ID or name.

  • member_id – Member ID to remove.

set_board_description(board: str, description: str)[source]#

Change the description of a board.

Parameters:
  • board – Board ID or name.

  • description – New description.

set_board_name(board: str, name: str)[source]#

Change the name of a board.

Parameters:
  • board – Board ID or name.

  • name – New name.

set_card_description(card_id: str, description: str)[source]#

Change the description of a card.

Parameters:
  • card_id – Card ID

  • description – New description

set_card_due(card_id: str, due: str | datetime)[source]#

Set the due date for a card.

Parameters:
  • card_id – Card ID

  • due – Due date, as a datetime.datetime object or an ISO string

set_card_due_complete(card_id: str)[source]#

Set the due date of a card as completed.

Parameters:

card_id – Card ID

set_card_name(card_id: str, name: str)[source]#

Change the name of a card.

Parameters:
  • card_id – Card ID

  • name – New name

set_list_name(board: str, list: str, name: str)[source]#

Change the name of a board list.

Parameters:
  • board – Board ID or name

  • list – List ID or name

  • name – New name

unassign_card(card_id: str, member_id: str)[source]#

Un-assign a card.

Parameters:
  • card_id – Card ID

  • member_id – Member ID

update_comment(card_id: str, comment_id: str, text: str)[source]#

Update the content of a comment.

Parameters:
  • card_id – Card ID

  • comment_id – Comment ID

  • text – New comment text