Scaling objects with data modification
this is simple script for scaling all bones in the active armature :

import bpy
ob = bpy.context.object
bpy.ops.object.mode_set(mode='POSE')

for bone in ob.pose.bones:    
     if not bone.parent : # since children inherit scale no need to scale them 
        bone.scale *=0.5

bpy.ops.object.mode_set(mode='OBJECT')


to remove scale inheritence  :

for bone in ob.data.bones:
        if bone.parent :
            bone.use_inherit_scale = False

#scale all bones
bpy.ops.object.mode_set(mode='POSE')
for bone in ob.pose.bones:    
        bone.scale *=0.5
bpy.ops.object.mode_set(mode='OBJECT')


scaling in edit mode :

import mathutils
bpy.ops.object.mode_set(mode='EDIT')

mat = mathutils.Matrix.Scale(0.5, 3)

for bone in ob.data.edit_bones:
        bone.transform(mat,  scale = True, roll = False)

bpy.ops.object.mode_set(mode='OBJECT')