当前位置: 代码迷 >> python >> 如何通过Trello API发布和检索评论卡数据?
  详细解决方案

如何通过Trello API发布和检索评论卡数据?

热度:27   发布时间:2023-06-16 10:09:13.0

我正在构建一个Web应用程序,该Web应用程序使用其API向Trello推入/拉出数据。

当前的堆栈是 ,我使用来管理大多数API调用。 但是有一个终结点让我感到困惑:

似乎当前的实现无法提供发布新评论并立即检索其数据的方法。 例如,您可以使用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将创建的列表对象作为JSON对象返回。 将此JSON转换为对象。

有没有办法对评论做同样的事情? 卡类具有“添加注释”功能( )。

但是Trello似乎一无所获...

>>> # 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

有什么线索吗? 非常感谢 !

问题来自py-trello当前的实现。 看到我的答案: :

谢谢大家!

  相关解决方案