py-trello icon indicating copy to clipboard operation
py-trello copied to clipboard

AttributeError: 'Member' object has no attribute 'badges'

Open tgrandje opened this issue 4 years ago • 0 comments

I've seen there were closed issues about this (maybe not about Member objects, I'm not positive about this), but using the last version of py-trello it still happens.

So let's go :

import trello
api_key = "..."
api_secret = "..."
token = "..."
id_board = '...'
client = trello.TrelloClient(api_key=api_key, api_secret=api_secret, token=token)
board = client.get_board(id_board)
users = board.all_members()
first_user_comments = users[0].fetch_comments()

This will raise AttributeError: 'Member' object has no attribute 'badges'.

I've teste a change of fetch_comments (line 36 of member.py)

def fetch_comments(self):
        comments = self.client.fetch_json(
            '/members/' + self.id + '/actions',
            query_params={'filter': 'commentCard'})
        return sorted(comments, key=lambda comment: comment['date'])

This works fine (with or without comments) ; I just don't know if it is worth a commit regarding the issue from last year... Let me know what you think about it.

tgrandje avatar Dec 11 '20 16:12 tgrandje