Skip to content

Commit

Permalink
Fixed fetch_actions for individual cards.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Anton Sherkhonov committed Sep 3, 2017
1 parent 88a4eca commit 6b818c6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions trello/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 6b818c6

Please sign in to comment.