Operating on selected Graph Editor keyframes in Python

I’d like to make an operator that can be used to tweak programmatically the easing properties of selected keyframes (in the graph editor or the dopesheet)

But I cannot, for the life of me, find where can I loop through the selected keyframes.

Does anyone know? I’ve tried searching the forum without much luck.
Thanks!

Found out that these are not aggregated, but you can loop through them and check for
k.select_control_point, k being a kefyrame, you can, then, selectively tweak the values of easing, interpolation, etc. and more “exotic” values like the amount of back for the BACK easing, etc.

https://docs.blender.org/api/blender2.8/bpy.types.Keyframe.html?highlight=ease_in_out

to find them all,

import bpy

for a in bpy.data.actions:
    for f in a.fcurves:
        points = f.keyframe_points        
        for p in points:
            if not p.select_control_point:
                continue 
            
            p.easing =  'EASE_IN_OUT'
            p.interpolation = 'BACK'
            p.back = 1.5

Created a quick addon for tweaking selected keyframes,


…just in case anyone stumbles upon this.