本文整理汇总了Python中trello.TrelloClient.info_for_all_boards方法的典型用法代码示例。如果您正苦于以下问题:Python TrelloClient.info_for_all_boards方法的具体用法?Python TrelloClient.info_for_all_boards怎么用?Python TrelloClient.info_for_all_boards使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trello.TrelloClient
的用法示例。
在下文中一共展示了TrelloClient.info_for_all_boards方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from trello import TrelloClient [as 别名]
# 或者: from trello.TrelloClient import info_for_all_boards [as 别名]
class Recent:
"""
Class used to retrieve recent Trello updates. Uses sarumont's py-trello API wrapper lightly.
Currently I just grab the full lump of data from the board API call.
For my use of Trello this works just fine, but if you're using it really
heavily I could see this using up too much memory, or the resultant xml being too big or something.
Could improve that by specifying exactly what we want with the ?filter param, or digging into using
the lists/cards apis more directly. However, I'm currently serving over 100 rss feeds on
trellorss.appspot.com with this method, so it works well enough, even if it kind of bothers me.
"""
def __init__(self, api_key, api_private_key, token=None, board_id=None, public_board=False, all_private=False):
self.api_key = api_key
self.api_private_key = api_private_key
self.token = token
self.public_only = False
if self.token is None:
self.public_only = True
self.trello = TrelloClient(self.api_key, self.api_private_key, self.token)
self.boards = None # Lazy, so doesn't fetch until we ask for them
self.board_id = board_id
self.public_board = public_board
self.all_private = all_private
# A list of items currently supported. The user should pass in one of the keys below,
# and we use the values when passing it to the Trello API.
self.items = config.all_item_types
def create_date(self, date):
return datetime.strptime(date[:-5], '%Y-%m-%dT%H:%M:%S')
def fetch_items(self, item_names):
""" Fetch the specified recent activity for item_names """
for item in item_names:
if item not in self.items:
raise InvalidItem("%s is not a supported item." % item)
items = ','.join([self.items[item] for item in item_names])
if self.all_private:
return self._get_activity(items, None)
else:
return self._get_activity(items, self._get_boards())
def _get_boards(self):
""" Calls the list_boards() method if we haven't already """
if self.board_id:
self.boards = self.trello.get_board(self.board_id)
elif self.boards is None:
self.boards = self.trello.list_boards()
return self.boards
def _get_activity(self, action_filter, boards):
"""Given a action filter, returns those actions for boards from the Trello API"""
actions = []
if self.all_private:
self.trello.info_for_all_boards(action_filter)
actions.append(self.trello.all_info)
else:
if isinstance(boards, list) is False:
boards = [boards]
for board in boards:
if board.closed is False:
board.fetch_actions(action_filter)
if len(board.actions) > 0:
actions.append(board.actions)
return actions