类型为"BeautifulSoup"的对象不可 JSON 序列化



我正试图将html内容加载到合流页面。我正试图使用BeautifulSoup pkg来实现这一点。在这个过程中,我得到低于误差。有什么方法可以解决这些问题,或者有什么方法可以完成这个任务吗?

TypeError: Object类型'BeautifulSoup'是不可JSON序列化的

下面是html文件的内容

<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.
<br>This is going < ,= to print
This is going >  to print</br>

代码:

import yaml
from atlassian import Confluence
import urllib, mimetypes
import  requests
import codecs,json
confluence = Confluence(
url='https://confluence.com',
username='12344',  # of system where this page would open
password='abcd')
####reading HTML file
with open("sample.html", 'r')as f
content = f.read()
soup = BeautifulSoup(content, 'html.parser')

# Create page from scratch
status = confluence.create_page('ABCD' ,#space,
'Report',#title
soup ,#'This is the body',#body,
parent_id=123456,### this is the pageid of the page under which new page will be created
type='page',
representation='storage',
editor='v2')
print(status)
status = confluence.create_page('ABCD' ,#space,
'Report',#title
soup ,#'This is the body',#body,
parent_id=123456,### this is the pageid of the page under which new page will be created
type='page',
representation='editor')

使用这个我们可以实现