XML-RPC - Anyone can share a pyone example please?

Hi all,

Can anyone give a simple example of how to list all VM, using pyone?
I see one.vmpool.info but not sure how to use it. I read the XML-RPC doc, but I’m totally confuse. One example would help me start. Thank you all.

Hi, check this code, you can see how I work with pyone

https://gitlab.feldhost.cz/feldhost-public/one-addon-backup-3par/blob/master/backup.py

Thanks a TON for the response. I made many tries with Python today, and finally getting a grasp of it. If anyone else is interested, that’s basically how I pull out all the VM names for example:

import pyone

one = pyone.OneServer(“http://vlab.ale-aapp.com:2633/RPC2”, session=“oneadmin:YOUR_PASSWORD”)

vmpoolInfo = one.vmpool.infoextended(-1, -1, -1, -1)
vmlist = vmpoolInfo.get_VM()

for vm in vmlist:
print(vm.NAME)

1 Like

On the other hand, would you know how to get the snapshot list if I do for example something like

vm = one.vm.info(###) …?

but I dont understand how to get the list of snapshots after that …
Thanks!

You can print vm var to see structure. You can also use pretty print pprint

When I try to §print, in either case I have:

<pyone.bindings.VMType84Sub object at 0x7fca283b10f0>

try print vm.__dict__

Back to this topic, I made some good advancement.
On the other hand, when I look at the API Documentation for one.user.delete for example. it shows 4 OUT (Boolean, Int/String, Int, Int). Anytime I delete a user, all I get is one int (the id of the user deleted). How do you get the other 3 variables?

I would also like to know how to get the other output parameters in pyone?

Any examples on it will really help us.

Thanks
Abhijit