不是类型';NodeMixin'-Python任意树

不是类型';NodeMixin'-Python任意树,python,json,anytree,Python,Json,Anytree,当我尝试使用anytree模块使用父节点的json值时,我遇到了以下错误,如何才能将json值作为父节点 这是我的密码 def Get_Full_Name(): name = names.get_full_name() return name def Type_Name(): ListType = ['Room', 'Building', 'Bed'] number = random.sample([int(x) for x in range(1, 3)],

当我尝试使用anytree模块使用父节点的json值时,我遇到了以下错误,如何才能将json值作为父节点

这是我的密码

def Get_Full_Name():
    name = names.get_full_name()
    return name


def Type_Name():
    ListType = ['Room', 'Building', 'Bed']
    number = random.sample([int(x) for x in range(1, 3)], 1)
    RandomList = ListType[number[0]]
    return RandomList



headers = {
    'accept': 'text/plain',
    'Content-Type': 'application/json-patch+json',
}

name = Get_Full_Name()
ListValue = Type_Name()
params = (
    ('name', name),
    ('type', 'BuildingGroup'),
)

data = '["{}"]'.format(name)

response = requests.post('http://SampleApiURL/', headers=headers,
                         params=params, data=data)


response_body = response.json()
print("Parent: " + response_body)
headers = {
    'accept': 'text/plain',
}

response2 = requests.get('http://SAmpleApiUrl/' + response_body, headers=headers)

response_body1 = response2.json()
RootNode = AnyNode(response_body1)
#ChildL2 = AnyNode(response_content="someValue", parent=RootNode)

exporter = JsonExporter(indent=4, sort_keys=True)
print  (exporter.export(RootNode))
我得到的错误是

Parent node {'locationId': 'LocationId', 'name': 'Andrew Rice', 'type': 'BuildingGroup', 'patientId': None, 'children': None} is not of type 'NodeMixin'.

如何使用Json作为父节点?

您是否需要首先使用
JsonImporter
response\u body
(假设是Json)导入到
anytree
树中?