keyframe code

objects
    nla_tracks
        strips
            action
                group
                    channels
                        keyframe_points
action
    group
        channels
            keyframe_points
# object track strip action
>>> bpy.data.objects['Cube'].animation_data.nla_tracks['NlaTrack'].strips['A'].action
bpy.data.actions['CubeAction']
 
# first keyframe position
>>> bpy.data.actions['CubeAction'].frame_range[0]
7.0
 
# last keyframe position
>>> bpy.data.actions['CubeAction'].frame_range[1]
59.0
 
# channels
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8]
bpy.data.actions['CubeAction.002']...FCurve
 
channels are keying sets like LocRotScale
so channel[8] is 'Z Scale'
 
# type
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1].type
'KEYFRAME'
 
# keyframe extrapolation
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].extrapolation
'CONSTANT'
 
# keyframe points
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1]
bpy.data.actions['CubeAction.002']...Keyframe
 
# point interpolation
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1].interpolation
'BEZIER'
 
# point position
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1].co
Vector((221.0, 1.0))
 
# point handle left
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1].handle_left
Vector((202.65066528320312, 1.0))
 
# point handle right
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1].handle_right
Vector((239.34933471679688, 1.0))
 
# point selected
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1].select_control_point
True
 
# point handle selected
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1].select_left_handle
True