I would suggest doing it with the GUI first and then examine the data structure.
I.e. added a driver to the Composite Node
The path is relative to node_tree
.
So try to add the driver to node_tree
with the given data path
import bpy
#right click on the socket value of the node -> Copy Data Path
path = 'nodes["Composite"].inputs[1].default_value'
scene = bpy.context.scene
scene.use_nodes = True
driver = scene.node_tree.driver_add(path)