WRL files are simple text files, so you can manually generate the file. Here is an example WRL file that creates a cylinder:
	Code:
	Transform {
	translation 0 0.25 0
	rotation 0 1 0 0
	scale 1 1 1
	children [
		Shape {
			geometry Cylinder { radius 0.05 height 0.5 }
		}
	]
}
 You can use Python file routines to open a file, write the contents of the wrl, and close it.