How to make a script switching Active Camera to orthographic mode?
import bpy
scene = bpy.context.scene

scene.camera.data.type = 'ORTHO' # set to ortho


and to perspective

scene.camera.data.type = 'PERSP' # set to perspectve