How to save viewport image when running Blender as Python module
Yes, you can save images rendered from the viewport.
# Set save path
sce = bpy.context.scene.name
bpy.data.scenes[sce].render.filepath = &quot;./image.png&quot;

# Go into camera-view (optional)
for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        area.spaces[0].region_3d.view_perspective = 'CAMERA'
        break

# Render image through viewport
bpy.ops.render.opengl(write_still=True)

Here are all the different python rendering commands.
A tip for finding out python commands: go into Blender, then Edit &gt; Preferences &gt; Interface tab &gt; check Python Tooltips box. Then you can hover your cursor over any button and the python code command will display as well.
By the way: I am not sure what you mean by 'real-time updated'?