def __init__(self, user_name, key, token): self.key = key self.token = token self.user_name = user_name self.org_api = Organizations(key, token) self.board_api = Boards(key, token) self.list_api = Lists(key, token) self.card_api = Cards(key, token) self.member_api = Members(key, token)
def get_actions(card_id): card = Cards(TRELLO_APP_KEY, TRELLO_APP_TOKEN) actions = card.get_action(card_id) update_actions = [] get_lead_time(actions) for action in actions: if action['type'] != 'commentCard': update_actions.append(action) list_before = action['data']['listBefore']['name'] list_after = action['data']['listAfter']['name'] return update_actions
async def on_ready(self): # Access API access information in Creds.ini config = configparser.ConfigParser() config.read("Creds.ini") # How to reference the Trello board global board global b_id # How to reference a list on the Trello board global c_list # How to reference a card on the Trello board global cards board = Boards(config.get('trello', 'api_key'), config.get('trello', 'token')) b_id = config.get('trello', 'board_id') c_list = Lists(config.get('trello', 'api_key'), config.get('trello', 'token')) cards = Cards(config.get('trello', 'api_key'), config.get('trello', 'token')) print("Trello online.")
def get_members(card_id): card = Cards(TRELLO_APP_KEY, TRELLO_APP_TOKEN) members = card.get_member(card_id) return members
boardId = data["actions"][0]["data"]["board"][ "id"] # ID of the board we're working on print( "Copy and paste the following link in your web browser to get a new token." ) print( trello.get_token_url("Similar Label Detector", expires="30days", write_access=True)) # visit site to get 64-character token # 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"
TRELLO_CONFIG = { 'api_key': 'TRELLO_API_KEY', 'oauth_token': 'TRELLO_OAUTH_TOKEN_FOR_BOARD', 'board_id': 'BOARD_ID', 'list_id_in_progress': 'LIST_ID', 'list_id_done': 'LIST_ID', } WEBHOOK_CONFIG = { 'host': '0.0.0.0', 'port': 7343 } TRELLO_LIST = Lists(TRELLO_CONFIG['api_key'], TRELLO_CONFIG['oauth_token']) TRELLO_CARDS = Cards(TRELLO_CONFIG['api_key'], TRELLO_CONFIG['oauth_token']) @route("/") def index(): return 'git webhook for move trello cards' @route("/webhook", method='POST') def handle_payload(): json_payload = None from_gitlab = False if request.get_header('Content-Type', None) == 'application/json': json_payload = request.json from_gitlab = True else: