我需要将以下cURL命令转换为python请求。
curl 'https://test.com/api/v1/courses/xx/discussion_topics/xx/entries.json' \
-F 'message=<message>' \
-H "Authorization: Bearer <token>"
到目前为止,我有requests.post("https://test.com/api/v1/courses/xx/discussion_topics/xx/entries")
但是如何添加消息和auth?
答案 0 :(得分:0)
requests.post("https://test.com/api/v1/courses/xx/discussion_topics/xx/entries.json, data=json.dumps({"message": "<message>"}), headers={"Authorization": "Bearer <token>"})