Hi
I am trying to call a VCO workflow from a python script on a ESXi 6.0 host. Hopefully this is the most appropriate forum. The below script works if I run it from a python install on my laptop. The expected out put is meant to be a listing of the Configure Mail workflow.
#! /bin/python
import urllib2
import base64
import ssl
import xml
from urlparse import urlparse
vroServer = '192.168.199.6:8281'
print vroServer
theurl = 'https://' + vroServer + '/vco/api/workflows/?conditions=name=Configure%20mail'
print theurl
username = 'vcoadmin@vsphere.local'
password = 'vcoadmin'
context = ssl.CERT_NONE
ssl._create_default_https_context = ssl._create_unverified_context
req = urllib2.Request(theurl)
print req
base64string = base64.encodestring('%s:%s' % (username, password))[:-1]
authheader = "Basic %s" % base64string
req.add_header('User-agent', 'Mozilla/5.0')
req.add_header('Content-Type','application/xml')
req.add_header('Accept','application/xml')
req.add_header('Authorization', authheader)
print req
handle = urllib2.urlopen(req)
thepage = handle.read()
print thepage
The output I get is below
Traceback (most recent call last): File "./VCOTest.py", line 28, in <module> handle = urllib2.urlopen(req) File "/build/mts/release/bora-3247720/bora/build/esx/release/vmvisor/sys-boot/lib/python2.7/urllib2.py", line 154, in urlopen File "/build/mts/release/bora-3247720/bora/build/esx/release/vmvisor/sys-boot/lib/python2.7/urllib2.py", line 431, in open File "/build/mts/release/bora-3247720/bora/build/esx/release/vmvisor/sys-boot/lib/python2.7/urllib2.py", line 449, in _open File "/build/mts/release/bora-3247720/bora/build/esx/release/vmvisor/sys-boot/lib/python2.7/urllib2.py", line 409, in _call_chain File "/build/mts/release/bora-3247720/bora/build/esx/release/vmvisor/sys-boot/lib/python2.7/urllib2.py", line 1240, in https_open File "/build/mts/release/bora-3247720/bora/build/esx/release/vmvisor/sys-boot/lib/python2.7/urllib2.py", line 1197, in do_open urllib2.URLError: <urlopen error [Errno 110] Connection timed out>
Thanks .