From 6b818c66d62007aeb7df79439d96d58b7a6c6696 Mon Sep 17 00:00:00 2001 From: Anton Sherkhonov Date: Sun, 3 Sep 2017 22:59:45 +0000 Subject: [PATCH] Fixed fetch_actions for individual cards. since/before parameters shouldn't be specified in the query if they are not specified in the method params. Added action_limit - limit of actions to fetch --- trello/card.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/trello/card.py b/trello/card.py index 18d4cc96..5f569633 100644 --- a/trello/card.py +++ b/trello/card.py @@ -263,16 +263,22 @@ def fetch_attachments(self, force=False): def get_attachments(self): return [Attachments.from_json(attachments_json) for attachments_json in self.fetch_attachments(force=True)] - def fetch_actions(self, action_filter='createCard', since=None, before=None): + def fetch_actions(self, action_filter='createCard', since=None, before=None, action_limit=50): """ Fetch actions for this card can give more argv to action_filter, split for ',' json_obj is list """ + query_params={'filter': action_filter, 'limit': action_limit} + if since: + query_params["since"] = since + + if before: + query_params["before"] = before + json_obj = self.client.fetch_json( '/cards/' + self.id + '/actions', - query_params={'filter': action_filter, - "since": since, - "before": before}) + query_params=query_params) + self.actions = json_obj return self.actions