How do you access and set a specific bone animation fcurve in python ? e.g. set pinky02_L z rotation = 8 degrees
Some py console code.

Below are some ways to find an fcurve for specific pose bone, and pose bone property.  In this example the context pose bone, and rotation_quaternion.

&gt;&gt;&gt; ob = C.object
&gt;&gt;&gt; 
&gt;&gt;&gt; action = ob.animation_data.action
&gt;&gt;&gt; pb =  context.active_pose_bone
&gt;&gt;&gt; pb.name
'Bone'

&gt;&gt;&gt; # could query the pose bone  from collection via its name
&gt;&gt;&gt; ob.pose.bones.get(pb.name)
bpy.data.objects['Armature'].pose.bones["Bone"]

&gt;&gt;&gt; print(pb.path_from_id.__doc__)
.. method:: path_from_id(property="")

   Returns the data path from the ID to this object (string).

   :arg property: Optional property name which can be used if the path is
      to a property of this object.
   :type property: string
   :return: The path from :class:`bpy.types.bpy_struct.id_data`
      to this struct and property (when given).
   :rtype: str

# get the path from pb.id_data 
&gt;&gt;&gt; dp = pb.path_from_id("rotation_quaternion")
&gt;&gt;&gt; dp
'pose.bones["Bone"].rotation_quaternion'

&gt;&gt;&gt; # could also build this from name
&gt;&gt;&gt; 'pose.bones["%s"].rotation_quaternion' % pb.name
'pose.bones["Bone"].rotation_quaternion'

&gt;&gt;&gt; # use find for one offs
&gt;&gt;&gt; print(action.fcurves.find.__doc__)
ActionFCurves.find(data_path, index=0)
Find an F-Curve. Note that this function performs a linear scan of all F-Curves in the action.
# find rotquot[3] aka rotquot.z
&gt;&gt;&gt; fc = action.fcurves.find(dp, index=3)
&gt;&gt;&gt; fc
bpy.data.actions['ArmatureAction']...FCurve

&gt;&gt;&gt; fc.array_index
3
# use list comp to find them all for for each index
&gt;&gt;&gt; ["%s[%d]" % (dp, fc.array_index) for fc in action.fcurves if fc.data_path == dp]
['pose.bones["Bone"].rotation_quaternion[0]', 'pose.bones["Bone"].rotation_quaternion[1]', 'pose.bones["Bone"].rotation_quaternion[2]', 'pose.bones["Bone"].rotation_quaternion[3]']

&gt;&gt;&gt; # get the value from ob using dp 
&gt;&gt;&gt; ob.path_resolve("%s[%d]" % (dp, fc.array_index))
-0.43060973286628723
# ie ob.pose.bones["Bone"].rotation_quaternion[3] = -0.43
&gt;&gt;&gt; pb.id_data.path_resolve("%s[%d]" % (dp, fc.array_index))
-0.43060973286628723


Links

Get bones associated with specific action in python

How can I tell if a bone property has a keyframe on the current frame using python?

How can I access bone&#39;s &#39;animation_data.action&#39;?

On rotations, here is the quaternion for an xyz Euler rotation of degrees (8, 8, 8)

&gt;&gt;&gt; rot = Euler((radians(8) for axis in "xyz"))
&gt;&gt;&gt; rot.to_quaternion()
Quaternion((0.9930493831634521, 0.06456293165683746, 0.07427114993333817, 0.06456293165683746)) # wxyz


To set the defaults to above would set each keyframe.y of keyframes in fcurve  fc with array_index=3 to 0.06.. etc.