While likely not optimized the following appears to work both in blender 2.79b official and the 2.80 beta build I have at the moment and may assist in how to handle adding the key frames and manipulating them afterwards.
import bpy
obj = bpy.context.active_object # Your pre-existing selected curve
def add_keyframes(obj):
if obj.data.bevel_object: # verify bevel object already selected
obj.data.keyframe_insert(
"bevel_factor_start",
index=-1,
# frame=1, # defaults to current frame
# group=""
)
obj.data.keyframe_insert(
"bevel_factor_end",
index=-1,
# frame=1, # defaults to current frame
# group=""
)
add_keyframes(obj)
def mod_fcurve(obj, path):
for fc in obj.data.animation_data.action.fcurves:
if fc.data_path == path:
my_fc = fc
for pt in my_fc.keyframe_points:
pt.co.x += 1 # increase x 'frame number' of points
pt.co.y += 0.1 # increase y 'value' of all pts in curve
mod_fcurve(obj, "bevel_factor_start")
bpy.types.Curve
A curve objects data part is an instance of type Curve. $\endgroup$ – batFINGER Jan 31 '19 at 20:18