我正在尝试通过Confluence的API发布页面。我可以很好地发布html内容,但是如果将base64图像添加到html中,则会出现“ 400 Client Error:Bad Request for url”错误。任何有关如何解决它的建议将不胜感激。
data = {
"type": "page",
"title": “My Test Page”,
"space": { "key": "TEC" },
"body": { "storage": {
"value": report, # this is my HTML content
"representation": "storage"
}
}
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.post(url, data=json.dumps(data), auth=(user, password), headers=headers)
if r.status_code != requests.codes.ok:
r.raise_for_status()
报告中的html内容具有嵌入式图像:
''' <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAA…” /> '''