View3D operations problem
import bpy

for area in bpy.context.screen.areas:
    if area.type == "VIEW_3D":
        break

for region in area.regions:
    if region.type == "WINDOW":
        break

space = area.spaces[0]

context = bpy.context.copy()
context['area'] = area
context['region'] = region
context['space_data'] = space

bpy.ops.view3d.viewnumpad(context, 'EXEC_DEFAULT', type='TOP')
bpy.ops.view3d.view_persportho(context, 'EXEC_DEFAULT')


or without operators:

from mathutils import Quaternion

r3d = space.region_3d
r3d.view_perspective = "ORTHO"
#default - look down z-axis
r3d.view_rotation = Quaternion((1.0, 0.0, 0.0, 0.0))