I had a chance to use Trello API with python, so I will summarize it.
from trello import TrelloClient
import requests
key = '***********'
token = '***********'
trello = TrelloClient(key, token)
boards=trello.list_boards()
for board in boards:
print(board.name)
print(board.id)
print(board.url)
print("---------------")
#Substitute the ID of the board you want to know below
BOARD_ID="***********"
board=trello.get_board(BOARD_ID)
#Get list list
lists = board.all_lists()
#List name, list ID
for list_ in lists:
print(list_.name)
print(list_.id)
#Get a list of cards
cards=board.get_cards()
#Card name, description, ID, URL
for card in cards:
print(card.name)
print(card.desc)
print(card.id)
print(card.url)
print("------------------")
BOARD_ID="***********"
LIST_ID="***********"
board = client.get_board(BOARD_ID)
target_list = board.get_list(LIST_ID)
#Add card (card name,Description)
created_card = target_list.add_card("card_name","card_desc")
CARD_ID="***********"
#Select a card
card=trello.get_card(CARD_ID)
#Add a description
card.set_description("~~~~~~~~")
#Add comment
card.comment("~~~~~~~~")
CARD_ID="***********"
#Select a card
card=trello.get_card(CARD_ID)
file_path= "***********"
file = open(file_path, 'rb')
card.attach(name="~~~~~~~~",file=file)
Simple python script to upload a file to Trello.
I tried using the Trello API with Python + py-trello
[Python] Automatically add tweets with specific hashtags to Trello's card
Recommended Posts