''' First, install the latest release of Python wrapper: $ pip install ovh ''' import json import ovh def main(): """ Software to reboot a VPS from OVH using the OVH API Intend to be used as an example """ # Instanciate an OVH Client. # You can generate new credentials with full access to your account on # the token creation page with open("/home/ache/.ovh_auth", "r") as f_file: auth = f_file.read().strip().split(';') client = ovh.Client( endpoint=auth[0], # Endpoint of API OVH Europe application_key=auth[1], # Application Key application_secret=auth[2], # Application Secret consumer_key=auth[3], # Consumer Key ) result = client.get('/vps') print(json.dumps(result, indent=4)) ## ache.one result = client.post('/vps/vps446497.ovh.net/reboot') print(json.dumps(result, indent=4)) ## mail.ache.one #result = client.post('/vps/vps514854.ovh.net/reboot') #print(json.dumps(result, indent=4)) ## Useless test about task percentage #result = client.get('/vps/vps446497.ovh.net/tasks', # type='rebootVm', # Filter the value of type property (=) (type: vps.TaskTypeEnum) #) #print(json.dumps(result, indent=4)) if __name__ == '__main__': main()