Apply physics to multiple objects using script
Setup one object as template then the following code will set the template object as active object and select all objects. Finally bpy.ops.rigidbody.object_settings_copy() copies all attributes as the 'Copy from Active' button would do.

import bpy

scene = bpy.context.scene
scene.objects.active = bpy.data.objects["template"]  
for obj in scene.objects:
    if obj.type == 'MESH':
        obj.select = True


#bpy.ops.object.constraints_copy()
bpy.ops.rigidbody.object_settings_copy()