Modify driver target (or any property)
You can access it at shape_keys.animation_data.drivers.
import bpy

shape_key = bpy.context.object.active_shape_key
if shape_key is None:
    raise()

shape_keys = shape_key.id_data
if shape_keys.animation_data is None:
    raise()

for fc in shape_keys.animation_data.drivers:
    print(fc.data_path)
    print(fc.driver.type)

Hierarchy

Direct access
&gt;&gt;&gt; 
&gt;&gt;&gt; def fn(name):
...     if name == &quot;&quot;:
...         print(False)
...     else:
...         print(name)
... 
&gt;&gt;&gt; fn(bpy.data.shape_keys['Key'].animation_data.drivers[0].driver.variables[0].targets[0].bone_target)
False

&gt;&gt;&gt; bpy.data.shape_keys['Key'].animation_data.drivers[0].driver.variables[0].targets[0].bone_target = &quot;Bone.001&quot;
&gt;&gt;&gt; 
&gt;&gt;&gt; fn(bpy.data.shape_keys['Key'].animation_data.drivers[0].driver.variables[0].targets[0].bone_target)
Bone.001