Just want to set viewport to wireframe from script
Screen is divided into areas.

An areas active space, matches area type.

2nd script will set the 3d view in that space to solid shading, change text editor to 3d view to confirm. 

To set 3dviews  in context screen, find them first  

spaces3d = [a.spaces.active for a in context.screen.areas if a.type == 'VIEW_3D']
for s in spaces3d: 
    s.shading.type = 'SOLID'


If there are more than one view 3d open, you may wish to only set the largest area, can sort the list by area area (a.width * a.height)