I'm building a web app that pushes and pulls data to/from Trello using its API.
The current stack is pythonic and I use py-trello to manage most of the API calls. But there's one endpoint leaving me perplex : post a comment on a card
It seems like the current py-trello implementation does not provide a way to post a new comment and immediately retrieve its data. For example, you can do it with a List :
def add_list(self, name):
"""Add a list to this board
:name: name for the list
:return: the list
:rtype: List
"""
obj = self.client.fetch_json(
'/lists',
http_method='POST',
post_args={'name': name, 'idBoard': self.id}, )
return List.from_json(board=self, json_obj=obj)
Trello API return the created list object as a JSON object. py-trello turns this JSON into a List object.
Is there a way to do the same with Card comment? Card class comes with an "add comment" feature (code).
But Trello seems to return nothing...
>>> # Card definition
>>> card = Card(parent=trello_board, card_id=id)
>>> # Fetching card data
>>> card.fetch()
>>> # This is correctly pushed to Trello
>>> obj = card.comment('Foo, bar!')
>>> import pprint
>>> # Hoping to print a big fat JSON
>>> pp = pprint.PrettyPrinter(indent=4)
>>> pp.pprint(obj)
None
Any clue ? Thanks alot !
The issue was coming from py-trello current implementation. See my answer : https://github.com/sarumont/py-trello/issues/113
Thank you folks !