How to add drivers in node inputs in python?
Drive the default_value property of a particular input channel.

&gt;&gt;&gt; n = C.scene.world.node_tree.nodes.new("ShaderNodeMath")
&gt;&gt;&gt; d = n.inputs[0].driver_add("default_value")

&gt;&gt;&gt; d.driver.expression
'0.5'

&gt;&gt;&gt;