Changing settings of the 3D view with Python
show_only_render and viewport_shade are attributes of the SpaceView3D. So for your usage example you'd make the following change:

-      if area.type == 'SpaceView3D' :
-        show_only_render = True
-        viewport_shade = 'SOLID'
+        area.spaces[0].show_only_render = True
+        area.spaces[0].viewport_shade = 'SOLID'