What is the Difference between PySphere and PyVmomi?

Question:

I need to write python scripts to automate time configuration of Virtual Machines running on a ESX/ESXi host.
I don’t know which API to use.
I am able to find to python bindings for VMWare APIs viz. PySphere and PyVmomi.
Could anyone please explain what is the difference between them, which one should be used?

Asked By: anukalp

||

Answers:

I’m the (now former) VMware employee who helped get this out the door.

pyVmomi represents the official bindings of the vSphere API released by VMware. The functions and object names map directly to what’s documented in the vSphere Web Services SDK. It takes a while to get used to it and we should add some docs helping people map what’s in the official documentation to what you can actually use in pyVmomi, but it’s really all there and you’ll probably get more functionality than you would out of pysphere which wraps official API calls in API-specific function names.

One of the most complete projects that uses the vSphere API via pyVmomi is another project I helped open source, ThinApp Factory. I recommend looking at its source (specifically linked.py) to see what is possible.

If things are hard to use or unclear about pyVmomi, please feel free to file a bug on our Github. Have fun!

Answered By: joshk0

Just as Josh suggested its a clean interface to VMWare API it also support a few versions of python which is nice as it will allow you to migrate from lets say python2.7 to python3.3.

Answered By: Toure Dunnon

Also pyVmomi directly corresponds to the vsphere Managed Object browser.
So get to the MOB on the vcenter, figure out what properties you need, the methods as well and the 1 to 1 name convention from pyvmomi helps you achieve what you want.
(in short, you learn about vsphere api and are good to go with pyvmomi, no mapping in the head needed)

Answered By: Jack

pyvmomi is the official python library from VMWare for the vSphere API.

Related links:

Answered By: Banjer
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.