How to edit a page with Atlassian Python API


I’m starting to experiment with the Confluence REST API and I found the Atlassian Python API useful. My goal is to create confluence pages form .doc files where each page will contain one .doc file and the page will be formatted with the built in Word Macro to show the content of the file. Where I stuck is how to modify the page body after uploaded the doc to use the macro for rendering.
I think I should modify the body value to something like this:

‘value’: ‘

<ac:structured-macro ac:name=“viewdoc” ac:schema-version=“1”><ac:parameter ac:name=“name”><ri:attachment ri:filename=“test.docx” /></ac:parameter></ac:structured-macro>

Can you help me how to do it?