[英]How do you use the trello api to add a new card in Python?
I'm having a problem with the python trello api.我在使用 python trello api 时遇到问题。
Context: - I'm trying to add a new card with the trello api in a particular position in a list.上下文: - 我正在尝试在列表中的特定 position 中添加带有 trello api 的新卡。
Problem: - I can create a new card, but I can't add it to a particular position into the trello list.问题: - 我可以创建一张新卡,但我不能将它添加到特定的 position 到 trello 列表中。
Code:代码:
from trello import Lists
clientTrello = Lists(
apikey=key
token=token
)
clientTrello.new_card(listID, "Title", None, "Desc")
Any solutions/suggestions you can give would be appriciated.您可以提供的任何解决方案/建议都会被应用。
Unfortunately I don't know how to help you using the Python API, but if you take a look at the Trello Api it is possible to use the cards endpoint to achieve this - one of the query params is pos
.不幸的是,我不知道如何帮助您使用 Python API,但如果您查看Trello Api ,则可以使用此参数查询卡
pos
端点。
You should be able to do this.你应该能够做到这一点。
[note: there are a couple of python Trello API wrappers. [注意:有几个 python Trello API 包装器。 Below is using this one https://github.com/tghw/trello-py]
下面是用这个https://github.com/tghw/trello-py]
from trello import TrelloApi
TRELLO_APP_KEY = "" #your trello key
TOKEN = "" #your api token
listID = "" #the id for your list
cardPos = "top" #'top', 'bottom', or a number
trello = TrelloApi(TRELLO_APP_KEY, TOKEN)
newCard = trello.cards.new("My Card", idList=listID, desc="my card description", pos=cardPos)
print(newCard) #above returns json details of the card just created
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.