Setting camera clip end via Python
bpy.context.space_data is read-only, but it's properties are not.

For the active scene camera

context.scene.camera.data.clip_end


This gets the clip_end value for the active camera from the current scene, assuming there is one. If the current scene doesn't have an active camera, then context.scene.camera is None and this will raise an AttributeError.

For the viewport:

for a in bpy.context.screen.areas:
    if a.type == 'VIEW_3D':
        for s in a.spaces:
            if s.type == 'VIEW_3D':
                s.clip_end = &lt;your value&gt;


This iterates through all areas in the current screen until it finds a 3D view, then iterates through all spaces in the 3D view until it finds a 3D view space, which is the object containing the clip_end property.