How to import constraints by automation methods like script

I need to import constraint by programmable method.

It is good the solution is script language or compile language.

It will be also good it is even command line interface.