コード例 #1
0
def main(args):
    """Does the main function need a docstring?!!?!"""
    confRoot = os.environ.get('TRELLO', None)

    if confRoot is not None:
        fn = confRoot + os.sep + 'conf' + os.sep + 'default.json'
    else:
        print('Environment is not set correctly')
        sys.exit(1)

    with open(fn) as f:
        conf = json.load(f)
        key = conf['key']
        user = conf['user']
        token = conf['token']

    trello = TrelloApi(key, token)

    me = trello.members.get(user)

    id = me.get('id')
    b = trello.members.get_board(id)

    print(type(b))
    '''s = json.dumps(b, indent=4, sort_keys=True)
 print(s)'''

    for i in b:
        print(i['id'] + ' || ' + i['name'])
コード例 #2
0
def post_to_colony_trello(leads):
    lead_id = '5cf85281ceafe811d744c6d6'
    token = os.environ['TRELLO_TOKEN']
    key = os.environ['TRELLO_API_KEY']
    trello = TrelloApi(key, token)
    trello.set_token(token)
    _post(leads, lead_id, trello)
コード例 #3
0
def create_webhook(callbackURL, idModel, description=None):
    trello = TrelloApi(TRELLO["AppKey"], TRELLO["Token"])
    _call_and_check(trello.webhooks.new,
                    callbackURL,
                    idModel,
                    description=description)
    print("New webhook was created")
コード例 #4
0
def main(args):
 """This is the main function"""
 confRoot = os.environ.get('TRELLO', None)

 if confRoot is not None:
  fn = confRoot + os.sep + 'conf' + os.sep + 'default.json'
 else:
  print('Environment is not set correctly')
  sys.exit(1)

 with open(fn) as f:
  conf = json.load(f)
  key = conf.get('key')
  user = conf.get('user')
  token = conf.get('token')

 trello = TrelloApi(key, token)

 me = trello.members.get(user)
 print("Full name: " + me.get('fullName'))
 print("Boards: " + str(me.get('idBoards')))
 print("Organizations: " + str(me.get('idOrganizations')))

 s = json.dumps(me, indent=4, sort_keys=True)
 print(s)
コード例 #5
0
ファイル: upload.py プロジェクト: ZzAntares/pypriorapi
 def on_post(self, req, resp, token):
     trello = TrelloApi(trelloconfig.api_key, token=trelloconfig.token)
     trello_token = trello.get_token_url('My App',
                                         expires='30days',
                                         write_access=True)
     storage = ZODB.FileStorage.FileStorage('trees/' + token + '.fs')
     db = ZODB.DB(storage)
     connection = db.open()
     root = connection.root
     if hasattr(root, 'tree'):
         tree = root.tree
     else:
         resp.body = "Initialize first"
         connection.close()
         db.close()
         storage.close()
         return
     lst = list(btree.inorder(tree))
     connection.close()
     db.close()
     storage.close()
     if len(lst) > 0:
         id_new = trello.boards.new_list('Le5vKw7H', token)['id']
     for card in lst:
         trello.cards.new(card, id_new)
コード例 #6
0
    def authorize(self):
        self.app.log.debug('Authorizing a Trello user.')

        # validate required config parameters
        if not self.app.config.get('trello', 'auth_key'):
            raise error.ConfigError(
                "Missing config parameter 'trello.auth_key'! "
                "Please run 'scrum-tools trello authorize' first! ")

        try:
            tl = TrelloApi(self.app.config.get('trello', 'auth_key'))
            url = tl.get_token_url('scrum-tools',
                                   expires='30days',
                                   write_access=True)

            cprint(
                os.linesep.join([
                    "Please follow the link below and update these entries in the [trello] section "
                    "of your scrum-tools config: ",
                    "  auth_key = %s" %
                    self.app.config.get('trello', 'auth_key'),
                    "  auth_token = %s" % '<generated_token>'
                ]), 'green')
            cprint("URL: %s" % url, 'green')
        except RuntimeError as e:
            raise e
コード例 #7
0
def xls_to_trello(args):
    with open("secrets.json", "r") as f:
        d = json.load(f)

    TRELLO_KEY = d["apikey"]
    TRELLO_TOKEN = d["token"]

    trello = TrelloApi(TRELLO_KEY)
    trello.set_token(TRELLO_TOKEN)

    if args.board_id is None:
        board = trello.boards.new(args.board_name)
        BOARD_ID = board["id"]
    else:
        BOARD_ID = args.board_id

    df = pd.read_excel(args.path)
    lists = {}
    for name in df["Custom status"].unique():
        lists[name] = trello.boards.new_list(board["id"], name)

    for _, row in tqdm(df.iterrows(), desc="Exporting tasks", total=len(df)):
        list_id = lists[row["Custom status"]]["id"]
        trello.lists.new_card(
            list_id,
            row["Title"],
            due=None if pd.isna(row["End Date"]) else row["End Date"],
        )
コード例 #8
0
ファイル: get.py プロジェクト: wearecolorcoded/aldente
def job():
    trello = TrelloApi('API-KEY-HERE')

    #get cards from trello
    cards = trello.lists.get_card('LIST-ID-HERE')

    # open premade card_names main file in append mode (a+) to keep track of card names
    card_names = open('./card_names.txt', 'a+')

    # open premade tasks file in append mode (a+) to use for printer
    tasks = open('./tasks.txt', 'a+')

    # iterate over each card check that card name is NOT in the card_names file
    for obj in cards:
        # if name is in the card_names file do nothing
        if obj['id'] in open('card_names.txt').read():
            print 'already in the master list'
            pass
        else:  # add name into task file and the card_names file
            card_names.write(obj['id'] + '\n')
            tasks.write('\n\n\n\n\n' + obj['name'] + '\n\n\n\n\n:)')
            print "yo i'm printing"

# print task file if there's content
    if os.stat('tasks.txt').st_size > 0:
        call(['lpr', '-o', 'fit-to-page', 'tasks.txt'])

# clear task file
    f = open('tasks.txt', 'r+')
    f.truncate()
コード例 #9
0
 def run(self):
     """main entry point"""
     # connect to Jira
     self.logger.debug("Connecting to Jira API")
     j_options = {
         'server': self.config.JIRA_URL,
     }
     self.jira = JIRA(j_options, basic_auth=(self.config.JIRA_USER, self.config.JIRA_PASS))
     if not self.jira:
         self.logger.error("Error connecting to Jira")
         raise SystemExit(1)
     # connect to Trello
     self.logger.debug("Connecting to Trello API")
     self.trello = TrelloApi(self.config.TRELLO_APP_KEY,
                             token=self.config.TRELLO_TOKEN)
     if not self.trello:
         self.logger.error("Error connecting to Trello")
         raise SystemExit(1)
     self.logger.info("Connected to Trello")
     self.logger.debug("Getting Trello board")
     self.board = self.trello.boards.get(self.config.TRELLO_BOARD_ID)
     self.board_id = self.board['id']
     self.logger.info("Using board '{n}' ({u}; id={i})".format(n=self.board['name'], u=self.board['url'], i=self.board_id))
     self.logger.debug("Getting board lists")
     self.list_id = None
     for l in self.trello.boards.get_list(self.board['id']):
         if l['name'].lower() == self.config.TRELLO_DONE_LIST_NAME.lower():
             self.list_id = l['id']
             self.logger.info("Using done list {i}".format(i=self.list_id))
             break
     if self.list_id is None:
         self.logger.error("ERROR: Unable to find list with name '{n}' on board.".format(n=self.config.TRELLO_DONE_LIST_NAME))
         raise SystemExit(1)
     self.do_cards()
コード例 #10
0
ファイル: __init__.py プロジェクト: Jalkar/meal_recipes
def main(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')
    try:
        try:
            logging.info("connecting to Trello API")
            trello = TrelloApi(SECRETS.TRELLO_API_KEY)
            SECRETS.reload_trello_token()            
            trello.set_token(SECRETS.TRELLO_AUTH_TOKEN)
            ingredients = get_trello_check_list(trello)
        except HTTPError as e :
            token_url= trello.get_token_url('My App', expires='30days', write_access=True)
            logging.exception(e)
            return func.HttpResponse(
                f"Authentication error with Trello API. Please access to this url and update the configuration with the new token : \n {token_url}",
                status_code=401
            )

        keep_connection,note = get_checklist_from_keep()
        send_checklist_to_keep(ingredients,note) 
        sync_keep(keep_connection)

        logging.info("success!")       
        return func.HttpResponse(
             f"Succes ! The new ingredients added are the following : \n {ingredients}",
             status_code=200
        )
    except Exception as e:        
        logging.exception(e)
        return func.HttpResponse(
             str(e),
             status_code=500
        )
コード例 #11
0
def fetch(workdir, token, board_id):

    tr = TrelloApi(TRELLO_PUBLIC_APP_KEY)

    user_token = read_token(workdir)

    if token is not None:
        if is_valid_token(tr, token):
            logger.warning("Overriding default Trello token")
            user_token = token
        else:
            logger.critical("Invalid token specified")
            return None

    if user_token is None:
        logger.critical("No Trello access token configured. Use `setup` command or `--token` argument")
        return None

    tr.set_token(user_token)

    now = time.time()
    try:
        board = tr.boards.get(board_id)
    except HTTPError as e:
        logger.error(e)
        return None

    cards = dict(map(lambda x: [x["id"], x], tr.boards.get_card(board_id)))
    lists = dict(map(lambda x: [x["id"], x], map(tr.lists.get, set(map(lambda c: c["idList"], cards.itervalues())))))
    meta = {"board": board, "snapshot_time": now}

    return {"meta": meta, "cards": cards, "lists": lists}
コード例 #12
0
    def __init__(self):
        self.audience_id = 'c6e22b46fd'
        self.interest_category_id = 'interests-9872b92779'
        self.segement_field_id = 'interests-ddaa47f9ce'
        self.trello_token = os.environ['TRELLO_TOKEN']
        self.trello_key = os.environ['TRELLO_API_KEY']
        self.mailchimp_key = os.environ['MAILCHIMP_API_KEY']
        self.never_bouce_apy_key = os.environ['NB_APY_KEY']
        self.mailchimp_client = Client()
        self.mailchimp_client.set_config({"api_key": self.mailchimp_key})
        self.trello = TrelloApi(self.trello_key, self.trello_token)
        self.trello.set_token(self.trello_token)
        self.markdown2html = Markdown()

        self.segments = {
            'ruby':
            '55eaa52f81',
            'python':
            'febbd795e0',
            'javascript (backend/node/meteor)':
            'dd8317b5bb',
            'php':
            '804ccb1e24',
            'mobile':
            'c71d0c8111',
            'javascript (frontend/angular/react/vue)':
            '9d6ae89058',
            'interaction design (web design/mobile design/ui/ux)':
            'b7205a2deb',
            'graphic design (branding/logos/animations/illustrations)':
            'b00fcf9a76'
        }
コード例 #13
0
def setup_trello():
    with open('env.json') as env:
        config = json.load(env)

    trello = TrelloApi(config['TRELLO_APP_KEY'])
    trello.set_token(config['TRELLO_AUTH_TOKEN'])

    return config, trello
コード例 #14
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("-c",
                        "--client-api-key",
                        help="your app's client api key",
                        action="store",
                        required=True)
    parser.add_argument("-t",
                        "--token",
                        help="your app's access token",
                        action="store",
                        required=True)
    parser.add_argument("-b",
                        "--board-id",
                        help="your trello board id",
                        action="store",
                        required=True)
    args = vars(parser.parse_args())

    log_format = '%(asctime)s - %(name)s - %(levelname)s %(message)s'
    logging.basicConfig(format=log_format, level=logging.WARN)

    trello = TrelloApi(args['client_api_key'])
    trello.set_token(args['token'])

    fields = 'fields=id,idMembers,idLabels,idList,shortUrl,dateLastActivity,\
name'

    cards = trello.boards.get_card(args['board_id'], fields=fields)
    cards = trello_add_card_creation_date(cards)
    cards.sort(key=lambda c: c['timeDelta'])
    lists = group_by_list(cards)
    lists = replace_id_by_label(lists, trello)

    members = trello.boards.get('{}/members'.format(args['board_id']))
    for member in members:
        board_members[member['id']] = member['fullName']

    last_week = Delorean() - timedelta(weeks=1)
    print("Since {} - {}".format(last_week.humanize(), last_week.date))

    action_filter = 'filter=createCard,deleteCard,updateCard:closed,\
addMemberToCard,removeMemberFromCard,updateCard:idList'

    actions = trello.boards.get(
        '{}/actions?limit=1000&filter={}&since={}'.format(
            args['board_id'], action_filter, last_week.date))
    # TODO add paging support if we go over 1000
    if len(actions) == 1000:
        logging.warn('the number of retried actions is over 1000, you may \
be missing other actions that occurred during the last week, \
please support paging')

    simple_actions = map(lambda a: transform_action(a), actions)
    describe_last_week_actions(simple_actions)
    print "---"
    for action in simple_actions:
        print action
コード例 #15
0
 def on_get(self, req, resp, lst):
     trello = TrelloApi(trelloconfig.api_key, token=trelloconfig.token)
     trello_token = trello.get_token_url('My App',
                                         expires='30days',
                                         write_access=True)
     response = trello.lists.get_card(lst)
     cards = []
     for card in response:
         cards.append(card['name'])
     resp.body = json.dumps(cards)
コード例 #16
0
 def on_get(self, req, resp, board):
     trello = TrelloApi(trelloconfig.api_key, token=trelloconfig.token)
     trello_token = trello.get_token_url('My App',
                                         expires='30days',
                                         write_access=True)
     response = trello.boards.get_list(board)
     lists = {}
     for lst in response:
         lists[lst['id']] = lst['name']
     resp.body = json.dumps(lists)
コード例 #17
0
 def on_get(self, req, resp):
     trello = TrelloApi(trelloconfig.api_key, token=trelloconfig.token)
     trello_token = trello.get_token_url('My App',
                                         expires='30days',
                                         write_access=True)
     response = trello.members.get_board('agusrumayor')
     boards = {}
     for board in response:
         boards[board['id']] = board['name']
     resp.body = json.dumps(boards)
コード例 #18
0
    def __init__(self):
        self.user = auth.user
        self.trello = TrelloApi(auth.key, auth.token)
        self.kl = self.trello.members.get_board(self.user)
        self.board_id = ''
        for item in self.kl:
            if item['name'] == auth.board:
                self.board_id = item['id']

        self.all_lists = self.trello.boards.get_list(self.board_id)
コード例 #19
0
def trello2Email(formInput):

    apikey = formInput['apikey']
    tocken = formInput['tocken']

    trello = TrelloApi(apikey)
    trello.set_token(tocken)
    boardId = formInput['Board_Id']

    cards = trello.boards.get_card(boardId, fields=("name", "idList"))
    lists = trello.boards.get_list(boardId)

    bufList = StringIO()
    bufCard = StringIO()
    boardLists = []
    boardcard = []
    cadNumber = []

    lis = 0
    for list in trello.boards.get_list(boardId):
        member_card = dict()
        listName = list['name']
        bufList.write(listName.encode('utf-8'))
        boardLists.append(bufList.getvalue())
        bufList.truncate(0)
        lis = lis + 1

        for card in trello.lists.get_card(list['id']):
            for member in card['idMembers']:
                if not member_card.has_key(member):
                    member_card[member] = []
                member_card[member].append(card)
        cad = 0
        for memberId in member_card.keys():
            member = trello.members.get(memberId)
            for card in member_card[memberId]:
                cardName = card['name']
                memberInitials = member['initials']
                bufCard.write(
                    memberInitials.encode('utf-8') + ' : ' +
                    cardName.encode('utf-8'))
                boardcard.append(bufCard.getvalue())
                bufCard.truncate(0)
                cad = cad + 1
        cadNumber.append(cad)

    html = getHtml.getHtmlFromBuf(boardLists, boardcard, cadNumber)
    print('successful')

    TO = formInput['Recipient_Email_Address']
    FROM = '*****@*****.**'
    subject = formInput['Subject']
    passw = 'jeaimevous'  #its not my personal account
    today = datetime.date.today()
    sendEmail.py_mail(subject, html, TO, FROM, passw)
コード例 #20
0
def startChecking(webhook_data):
    # Constants
    TRELLO_API_KEY = "1c7cec096175a93ed305cff00caf0592"
    TRELLO_API_TOKEN = "4ad7c1fa64ecb1c3e47928e60145f67fe035dd25238d9a9e817c6d13e436cd3d"
    BOARD_ID = "tbU0BvI3"
    # Trigger word for preparing
    TRIGGER = "lega"
    # Whitelist to dedicate users
    WHITELIST = [
        "trello",
    ]

    # Setting up trello
    trello = TrelloApi(TRELLO_API_KEY)
    trello.set_token(TRELLO_API_TOKEN)

    # Action type triggering
    action_type = "action_changed_description_of_card"

    # Check for action type
    if webhook_data["action"]["display"]["translationKey"] == action_type:
        # Member creator seperating
        member_creator = webhook_data["action"]["memberCreator"]
        # Check for trigger word and whitelist
        if TRIGGER in webhook_data["action"]["data"]["card"][
                "desc"] and not member_creator["username"] in WHITELIST:
            # Get shortlink from webhook
            shortlink = webhook_data["action"]["data"]["card"]["shortLink"]
            # Get all custom fields from server
            custom_fields = trello.cards.get_custom_fields_board(BOARD_ID)

            # Parsing necessary custom field
            custom_field = None
            for curr_cf in custom_fields:
                if not curr_cf["name"] == "Курьер" or not curr_cf[
                        "type"] == "text":
                    continue

                custom_field = curr_cf

                # Finded breaking...
                break

            # Check for custom field
            if custom_field:
                print(111)
                custom_field_id = custom_field["id"]
                member_creator_check = member_creator["fullName"]

                # Updating data in trello servers
                resp = trello.cards.update_custom_field(
                    shortlink, custom_field_id,
                    {"value": {
                        "text": member_creator_check
                    }})
コード例 #21
0
    def __init__(self, app_key, token, board_name):
        if not (all((app_key, token, board_name))):
            raise ValueError("app_key, token and board_name must be provided")
        else:
            self._app_key = app_key
            self._token = token
            self._board_name = board_name

        self.trello_handler = TrelloApi(self._app_key)
        self.trello_handler.set_token(self._token)
        super(TrelloParser, self).__init__()
コード例 #22
0
def cli(ctx):
    ctx.obj.config = ConfigParser()
    ctx.obj.config.read(CYKLE_CONFIG_FILE)
    if len(ctx.obj.config.items()) <= 1:
        return

    ctx.obj.trello_api = TrelloApi(ctx.obj.config.get('trello', 'apikey'),
                                   ctx.obj.config.get('trello', 'token'))
    ctx.obj.github_api = Github(
        ctx.obj.config.get('github', 'username'),
        base64.b64decode(ctx.obj.config.get('github', 'password')))
コード例 #23
0
    def create_boards(self):
        self.app.log.debug('Creating Trello boards.')

        # validate required config parameters
        if not self.app.config.get('trello',
                                   'auth_key') or not self.app.config.get(
                                       'trello', 'auth_token'):
            raise error.ConfigError(
                "Missing config parameter 'trello.auth_key' and/or 'trello.auth_token'! "
                "Please run 'scrum-tools trello authorize' first! ")

        # schema keys
        key_group = self.app.config.get('core', 'users_schema_key_group')
        key_trello = self.app.config.get('core', 'users_schema_key_trello')
        # organization
        organization = self.app.config.get('trello', 'organization')
        # boards setup
        board_admins_name = self.app.config.get('trello', 'board_admins')
        board_pattern = self.app.config.get('trello', 'board_pattern')
        board_lists = self.app.config.get('trello', 'board_lists')
        admins_group = self.app.config.get('trello', 'board_admins_group')

        # get the users
        user_repository = data.UserRepository(self.app.config)
        # create trello session
        tl = TrelloApi(self.app.config.get('trello', 'auth_key'),
                       self.app.config.get('trello', 'auth_token'))

        # get the organization
        org = tl.organizations.get(organization)
        if not org:
            raise RuntimeError("Organization '%s' not found" % organization)

        # get all organization boards
        boards = dict(
            (b['name'], b) for b in tl.organizations.get_board(organization))

        # create group boards
        for group in user_repository.groups():
            board_name = board_pattern % int(group)
            board_admins = set(u[key_trello] for u in user_repository.users(
                lambda x: x[key_group] == admins_group))
            board_members = set(u[key_trello] for u in user_repository.users(
                lambda x: x[key_group] == group))
            self.__create_board(tl, org, board_name, set(board_lists),
                                board_admins, board_members, boards)

        # create admins board
        board_admins = set(u[key_trello] for u in user_repository.users(
            lambda x: x[key_group] == admins_group))
        board_members = set()
        self.__create_board(tl, org, board_admins_name, set(board_lists),
                            board_admins, board_members, boards)
コード例 #24
0
def testUsingNewApiTrello():
    # trello = TrelloApi('')
    # https://pypi.org/project/trello/
    # https: // pythonhosted.org / trello / examples.html
    # print(os.environ["TRELLO_KEY"])

    config = TrelloConfig()
    tre = TrelloApi(config.key, config.token)

    #print('t:',tre.boards.get_card(config.idBoard))
    print('a:', tre.boards.get_action(config.idBoard))
    print('x:', tre.boards.get_list(config.idBoard))
コード例 #25
0
 def create_issue(self, request, group, form_data, **kwargs):
     description = TrelloSentry.reformat_to_markdown(
         form_data['description'])
     try:
         trello = TrelloApi(self.get_option('key', group.project),
                            self.get_option('token', group.project))
         card = trello.cards.new(name=form_data['title'],
                                 desc=description,
                                 idList=form_data['board_list'])
         return '%s/%s' % (card['id'], card['url'])
     except RequestException, e:
         raise forms.ValidationError(
             _('Error adding Trello card: %s') % str(e))
コード例 #26
0
def trello(oled):
    ourkey = open('.trello-screen-api-key').read();
    ourtoken = open('.trello-screen-token').read();
    ourlist = open('.trello-screen-list').read();
    trello = TrelloApi(ourkey, token=ourtoken)
    cards = trello.lists.get_card(ourlist)
    index = 0
    font2 = ImageFont.truetype('redalert.ttf', 12)
    with canvas(oled) as draw:
        draw.text((0,0), "Working on " + str(len(cards)) + " things:", font=font2, fill=255)
        while index < len(cards) and index < 4:
            draw.text((12,13+(index*13)),cards[index]['name'], font=font2, fill=255)
            index = index + 1
コード例 #27
0
def cad_pedido_trello(dados, valor_total):
    trello = TrelloApi(
        '3e07bd7f00974e1c71db3f0d30f3d50c',
        '55fb23e337aa599c137b1d23c225d1f5825a6274bf010c525a5c43ffe200b906')
    produtos = " "
    for produto in dados.produtos.all():
        produtos = produtos + '\n' + str(produto)
    card = trello.cards.new(
        'Pedido ' + str(dados.id), '5cdeee36a3d935459b57d978',
        'Cliente: \n\n' + 'nome: ' + str(dados.user.username) + '\n' +
        'email: ' + str(dados.user.email) + '\n\n' + 'Componentes: \n' +
        produtos + '\n\n' + 'Valor Total: ' + str(valor_total))
    return card['id']
コード例 #28
0
ファイル: fetch.py プロジェクト: KNI-Genbit/crossweb-trello
def trello_init():
    trello = TrelloApi(TRELLO_APP_KEY)
    try:
        trello.set_token(open('.token.txt').read().strip())
    except IOError:
        token_url = trello.get_token_url('Trello ',
                                         expires='never',
                                         write_access=True)
        print "Enter following URL in your browser:", token_url
        token = raw_input("Enter token please:")
        open('.token.txt', 'w').write(token)
        trello.set_token(token)
    return trello
コード例 #29
0
 def __init__(self, dry_run=False):
     """get credentials and connect"""
     self.dry_run = dry_run
     app_key = os.environ.get('TRELLO_APP_KEY', None)
     if app_key is None:
         raise SystemExit('Please export your Trello application key as the '
                          'TRELLO_APP_KEY environment variable.')
     token = os.environ.get('TRELLO_TOKEN', None)
     if token is None:
         raise SystemExit('Please export your Trello API token as the '
                          'TRELLO_TOKEN environment variable.')
     logger.debug('Initializing TrelloApi')
     self.trello = TrelloApi(app_key, token)
     logger.debug('TrelloApi initialized')
コード例 #30
0
 def init(cls, organization):
     trello = TrelloApi(TRELLO_APP_KEY)
     try:
         trello.set_token(open('.token.txt').read().strip())
         logger.debug("Trello token loaded")
     except IOError:
         token_url = trello.get_token_url('Trello ',
                                          expires='never',
                                          write_access=True)
         print("Enter following URL in your browser:", token_url)
         token = raw_input("Enter token please:")
         open('.token.txt', 'w').write(token)
         trello.set_token(token)
     return cls(trello, organization)