2

I am playing with the vSphere API and it worked good over the Web Interface, now I would like to write a Python Script that communicates with the API and give me some answers to my question like how many VM´s do I have in my Environment or which VM is currently running, for that I need to pass my Username and password to enter the vCenter, and ask the vCenter this questions, have somebody already did it this? and have the code for me or somebody a idea for fixing this problem?

serenesat
  • 4,611
  • 10
  • 37
  • 53
  • Hi Daniel, have you looked on vSphere websites - [link](https://code.vmware.com/samples/795/vmware-vsphere-connector-module-for-python) ? There are some examples incl. connetion to vSphere API (look at chapter Using the vConnector API) – Lukas Mar 15 '19 at 10:30

1 Answers1

1

Are you using an SDK to connect to the vCenter server?

Here's a sample to use Python to interact directly with the REST service, instead of an SDK: https://blog.dchidell.com/2016/11/23/vcenter-6-5-rest-api-w-python/

Kyle Ruddy
  • 1,886
  • 1
  • 7
  • 5
  • Thanks Kyle for your answer, it helped me, but noe i gonna build my own API to communicate with the Vsphere API, but this Dokuments wased a right step into the right direction. – Daniel Moreira Mar 20 '19 at 09:00