can I get the image rendered by blender in its "3D View" mode?

Like the image in the attachment. this is done by a manual screenshot.
However, I want a script to achieve this.


Do you just want to render with a wireframe or do you want a script to render with a wireframe. The first you can do simply just using materials without a script.