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 add_card(tlist, name, description=None): try: lists = Lists(trello_key, trello_token) list_id = tlist[0]['id'] print(list_id) print(lists.new_card) card = lists.new_card(list_id,name, due="3/19/2021",desc=description) return card except Exception as e: print(f" error {e}") raise
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.")
import json 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