Xarm How to rotate the toolhead with python sdk

Can anyone tell me how to rotate the toolhead continously left or right? with python sdk

Joint control or TCP control? If you use joint control, you could set the last joint angle. TCP control will be a bit complicate, you have to set the attitude.