我正在尝试使用Slack的Python客户端发送附件,但每当我这样做时,我都会失败。我也尝试用测试仪发送它,但它仍然无法正常工作。我得到{"ok": false,"error": "no_text"}
或者如果我有text属性,则只发送文本。我就是这样做的。我也搜索过,但没有找到任何东西。
attachment = json.dumps([{"attachments": [{"fallback": "Reddit Message","color": "#448aff","pretext":"You've got a new Message!","author_name": "Reddit","author_link": "https://reddit.com","author_icon": "imageurl","title": "Reddit Message","title_link": "https://reddit.com/message/inbox","text": "This is what I know about it.","fields": [{"title": "Author:","value": str(item.author),"short": "true"},{"title": "Subject: ","value": str(item.subject),"short": "true"},{"title": "Message:","value": str(item.body),"short": "false"}],"footer": "Reddit API","footer_icon": "anotherimageurl"}]})
sc.api_call("chat.postMessage",channel="U64KWRJAU",attachments=attachment,as_user=True)
帮助将不胜感激。这应该是有道理的,但我不明白为什么它不起作用
答案 0 :(得分:0)
根据您的参考,您需要将附件作为列表传递。您不需要在包含列表的字典中使用c = pd.Series([4], index=pd.MultiIndex.from_arrays([['digit'],['four']]))
b = pd.concat([b, c])
print (b)
digit one 1
one 1
two 2
three 3
four 4
dtype: int64
键。
attachments