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


Python TrelloClient.search方法代码示例

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


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

示例1: TrelloClientTestCase

# 需要导入模块: from trello import TrelloClient [as 别名]
# 或者: from trello.TrelloClient import search [as 别名]

#.........这里部分代码省略.........
            self.assertIsNotNone(b.name, msg="name not provided")
            self.assertIsNotNone(b.description, msg="description not provided")
            self.assertIsNotNone(b.closed, msg="closed not provided")
            self.assertIsNotNone(b.url, msg="url not provided")

    def test20_board_all_lists(self):
        boards = self._trello.list_boards()
        for b in boards:
            try:
                b.all_lists()
            except Exception:
                self.fail("Caught Exception getting lists")

    def test21_board_open_lists(self):
        boards = self._trello.list_boards()
        for b in boards:
            try:
                b.open_lists()
            except Exception:
                self.fail("Caught Exception getting open lists")

    def test22_board_closed_lists(self):
        boards = self._trello.list_boards()
        for b in boards:
            try:
                b.closed_lists()
            except Exception:
                self.fail("Caught Exception getting closed lists")

    def test30_list_attrs(self):
        boards = self._trello.list_boards()
        for b in boards:
            for l in b.all_lists():
                self.assertIsNotNone(l.id, msg="id not provided")
                self.assertIsNotNone(l.name, msg="name not provided")
                self.assertIsNotNone(l.closed, msg="closed not provided")
            break  # only need to test one board's lists

    def test50_list_cards(self):
        boards = self._trello.list_boards()
        for b in boards:
            for l in b.all_lists():
                for c in l.list_cards():
                    self.assertIsNotNone(c.id, msg="id not provided")
                    self.assertIsNotNone(c.name, msg="name not provided")
                    self.assertIsNotNone(c.description,
                                         msg="description not provided")
                    self.assertIsNotNone(c.closed, msg="closed not provided")
                    self.assertIsNotNone(c.url, msg="url not provided")
                break
            break
        pass

    def test51_fetch_cards(self):
        """
        Tests fetching all attributes for all cards
        """
        boards = self._trello.list_boards()
        for b in boards:
            for l in b.all_lists():
                for c in l.list_cards():
                    c.fetch()

                    self.assertIsInstance(c.date_last_activity, datetime,
                                          msg='date not provided')
                    self.assertTrue(len(c.board_id) > 0,
                                    msg='board id not provided')
                break
            break
        pass

    def test52_list_hooks(self):
        self.assertIsInstance(self._trello.list_hooks(), list)

    def test53_unauthorized(self):
        client = TrelloClient('a')
        self.assertRaises(Unauthorized,
                          client.list_boards)

    def test54_resource_unavailable(self):
        self.assertRaises(ResourceUnavailable,
                          self._trello.get_card, '0')

    def test_list_stars(self):
        """
        Test trello client star list
        """
        self.assertEqual(len(self._trello.list_stars()), int(os.environ["TRELLO_TEST_STAR_COUNT"]), "Number of stars does not match TRELLO_TEST_STAR_COUNT")

    def test_add_delete_star(self):
        """
        Test add and delete star to/from test board
        """
        test_board_id = self._trello.search(os.environ["TRELLO_TEST_BOARD_NAME"])[0].id
        new_star = self._trello.add_star(test_board_id)
        star_list = self._trello.list_stars()
        self.assertTrue(new_star in star_list, "Star id was not added in list of starred boards")
        deleted_star = self._trello.delete_star(new_star)
        star_list = self._trello.list_stars()
        self.assertFalse(deleted_star in star_list, "Star id was not deleted from list of starred boards")
开发者ID:sarumont,项目名称:py-trello,代码行数:104,代码来源:test_trello_client.py

示例2: TrelloClient

# 需要导入模块: from trello import TrelloClient [as 别名]
# 或者: from trello.TrelloClient import search [as 别名]
#!/usr/bin/python3

"""
simple python script to clean my trello archived items. 
it will look for archived cards in all boards to delete them.
"""

from trello import TrelloClient

CONFIG = {
    'api_key'         : "x",
    'server_token'    : "x",
}

client = TrelloClient(
    api_key         = CONFIG['api_key'],
    api_secret      = CONFIG['server_token'],
)

# manual list generated with:
# >> > for board in client.list_boards():
# ... print(board.__dict__)
my_boards = [
    'fill with ids',
    ]

for idx, card in enumerate(client.search(query="is:archived", cards_limit=1000, board_ids=my_boards, models="cards")):
    print(idx, card.id, card.board, card.name, card.url, card.list_id)
    #card.delete()
    print()
开发者ID:garmann,项目名称:playground,代码行数:32,代码来源:clean_trello_archived_items.py


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