当前位置: 首页>>代码示例>>Python>>正文


Python trello.TrelloClient方法代码示例

本文整理汇总了Python中trello.TrelloClient方法的典型用法代码示例。如果您正苦于以下问题:Python trello.TrelloClient方法的具体用法?Python trello.TrelloClient怎么用?Python trello.TrelloClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trello的用法示例。


在下文中一共展示了trello.TrelloClient方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_context_data

# 需要导入模块: import trello [as 别名]
# 或者: from trello import TrelloClient [as 别名]
def get_context_data(self, **kwargs):
        """ Fishy way to ensure trello_client is configured.
        """
        try:
            context = super(BoardView, self).get_context_data(**kwargs)
            token = self.request.GET.get('token')
            if token is None:
                context['board_list'] = None
            trello_client = TrelloClient(api_key=settings.TRELLO_APIKEY, token=token)
            trello_client.list_boards()
            user = self.request.user
            listboard = Board.objects.filter(trello_token=token)
            context['board_list'] = listboard
            context['trello_error'] = None
        except Exception as e:
            context['trello_error'] = "{} :: api_key={} :: token={}".format(e,
                    settings.TRELLO_APIKEY, settings.TRELLO_TOKEN)
        finally:
            return context 
开发者ID:Lujeni,项目名称:matterllo,代码行数:21,代码来源:board.py

示例2: __connect

# 需要导入模块: import trello [as 别名]
# 或者: from trello import TrelloClient [as 别名]
def __connect(self, config):
        trello_client = trello.TrelloClient(
            api_key=config.api_key,
            api_secret=config.api_secret,
            token=config.oauth_token,
            token_secret=config.oauth_token_secret,
        )
        try:
            # A simple API call (data reused in self.main_board) to initiate connection & test our credentials etc
            self.boards = trello_client.fetch_json('/members/me/boards/?filter=open')
            return trello_client
        except requests.exceptions.ConnectionError:
            print('[FATAL] Could not connect to the Trello API!')
            raise GTDException(1)
        except trello.exceptions.Unauthorized:
            print('[FATAL] Trello API credentials are invalid')
            raise GTDException(1) 
开发者ID:delucks,项目名称:gtd.py,代码行数:19,代码来源:connection.py

示例3: __init__

# 需要导入模块: import trello [as 别名]
# 或者: from trello import TrelloClient [as 别名]
def __init__(self):
        trello_config = Config.open_api.trello

        self.client = TrelloClient(
            api_key=trello_config.API_KEY,
            api_secret=trello_config.API_SECRET,
            token=trello_config.TOKEN,
        )
        self.board = self.client.get_board(trello_config.BOARD) 
开发者ID:DongjunLee,项目名称:quantified-self,代码行数:11,代码来源:trello.py

示例4: _get_client

# 需要导入模块: import trello [as 别名]
# 或者: from trello import TrelloClient [as 别名]
def _get_client(self) -> trello.TrelloClient:
        if not self._client:
            self._client = trello.TrelloClient(
                api_key=self.api_key,
                api_secret=self.api_secret,
                token=self.token,
            )

        return self._client 
开发者ID:BlackLight,项目名称:platypush,代码行数:11,代码来源:trello.py

示例5: _get_trello_client

# 需要导入模块: import trello [as 别名]
# 或者: from trello import TrelloClient [as 别名]
def _get_trello_client(self):
        client = TrelloClient(
            api_key=self.trello_member_profile.api_key,
            api_secret=self.trello_member_profile.api_secret,
            token=self.trello_member_profile.token,
            token_secret=self.trello_member_profile.token_secret
        )
        return client 
开发者ID:diegojromerolopez,项目名称:djanban,代码行数:10,代码来源:connector.py

示例6: get

# 需要导入模块: import trello [as 别名]
# 或者: from trello import TrelloClient [as 别名]
def get(self, request):
        try:
            token = request.GET.get('token')
            user = request.user
            if token is None:
                boards = None
                return super(BoardView, self).get(request)
            else:
                trello_client = TrelloClient(api_key=settings.TRELLO_APIKEY, token=token)
                boards = trello_client.list_boards()
                if boards:
                    result = [h.delete() for h in trello_client.list_hooks()]
                    print("delete trello hook :: result={}".format(result))

                for board in boards:
                    print ("BOARD_ID:", board.id)
                    slug_board = slugify(board.name, allow_unicode=False)
                    b, created = Board.objects.get_or_create(name=slug_board, user=user, trello_board_id = board.id, trello_token = token)
                    host = getenv("MATTERLLO_HOST") or request.get_host()
                    url = "{}://{}/callback/{}/".format(request.scheme, host, b.id)
                    result = trello_client.create_hook(url, board.id)
                    print("create trello hook :: callback={} :: board={} :: result={}".format(url, slug_board, result))
                return super(BoardView, self).get(request)
        except Exception as e:
            print("unable to display board :: {}".format(e))
            return super(BoardView, self).get(request) 
开发者ID:Lujeni,项目名称:matterllo,代码行数:28,代码来源:board.py

示例7: perform_import

# 需要导入模块: import trello [as 别名]
# 或者: from trello import TrelloClient [as 别名]
def perform_import(self, retreival_param, unit, token=None):
        #from clatoolkit.models import ApiCredentials
        #Set up trello auth and API
        self.TrelloCient = TrelloClient(
            api_key=os.environ.get("TRELLO_API_KEY"),
            token=token
        )
        #Get user-registered board in trello
        trello_board = self.TrelloCient.get_board(retreival_param)

        #Get boards activity/action feed
        trello_board.fetch_actions('all') #fetch_actions() collects actions feed and stores to trello_board.actions
        self.import_TrelloActivity(trello_board.actions, unit) 
开发者ID:kirstykitto,项目名称:CLAtoolkit,代码行数:15,代码来源:cladi_plugin.py

示例8: get_trello_boards

# 需要导入模块: import trello [as 别名]
# 或者: from trello import TrelloClient [as 别名]
def get_trello_boards():
    """ Get all Trello boards """
    trello_client = TrelloClient(api_key=trello_api_key, api_secret=trello_api_secret, token=trello_token, token_secret=trello_token_secret)
    return trello_client.list_boards(board_filter="open") 
开发者ID:ogarcia,项目名称:trellowarrior,代码行数:6,代码来源:main.py

示例9: create_trello_board

# 需要导入模块: import trello [as 别名]
# 或者: from trello import TrelloClient [as 别名]
def create_trello_board(board_name):
    """
    Create Trello board and returns it

    :board_name: the board name
    """
    trello_client = TrelloClient(api_key=trello_api_key, api_secret=trello_api_secret, token=trello_token, token_secret=trello_token_secret)
    return trello_client.add_board(board_name) 
开发者ID:ogarcia,项目名称:trellowarrior,代码行数:10,代码来源:main.py

示例10: delete_trello_card

# 需要导入模块: import trello [as 别名]
# 或者: from trello import TrelloClient [as 别名]
def delete_trello_card(trello_card_id):
    """
    Delete (forever) a Trello Card by ID

    :trello_card_id: Trello card ID
    """
    trello_client = TrelloClient(api_key=trello_api_key, api_secret=trello_api_secret, token=trello_token, token_secret=trello_token_secret)
    try:
        trello_card = trello_client.get_card(trello_card_id)
        trello_card.delete()
    except Exception:
        print('Cannot find Trello card with ID {0} deleted in Task Warrior. Maybe you deleted it in Trello too.'.format(trello_card_id)) 
开发者ID:ogarcia,项目名称:trellowarrior,代码行数:14,代码来源:main.py


注:本文中的trello.TrelloClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。