Manipulate XYZ rotation of texture mapping in python or macro

Is there a way?
Thanks.