how to call rest in python