Hi!
I'm not gonna lie, this node is a pain to work with. appearently the message attriubtes have a preassignet japanese string, no idea why. It doesn't allow to for multiple assignements of the same type, etc.
But I think I figured out a way to do what you want:
import maya.cmds as mc
def addAssignement(type = "", attribute = "", aiSetParameterNode = ""):
i = 0
message = "="
lenType= len(type)
while "=" in message:
message = mc.getAttr("{0}.assignment[{1}]".format(aiSetParameterNode,i))
i= i + 1
if message[:lenType] == type:
break
mc.setAttr("{0}.assignment[{1}]".format(aiSetParameterNode,i-1), "{0}='{1}'".format(type, attribute), type = "string")
addAssignement(type = "shader", attribute = "lambert2", aiSetParameterNode = "aiSetParameter1")
the type variable takes the left part of the assignmetn (eg. shader or displacement) and the attribute variable right part of the assignment. (name of shader, type of curve, etc)
the aiSetParameterNode variable takes the name of the Node you want to add the assignment to.
I hope it helps, and happy holidays!