def OpenPathWithStub(path, stub):
 from six.moves import http_client
 if (not hasattr(stub, 'scheme')):
  raise vmodl.fault.NotSupported()
 elif (stub.scheme == http_client.HTTPConnection):
  protocol = 'http'
 elif (stub.scheme == http_client.HTTPSConnection):
  protocol = 'https'
 else:
  raise vmodl.fault.NotSupported()
 hostPort = stub.host
 url = ('%s://%s%s' % (protocol, hostPort, path))
 headers = {}
 if stub.cookie:
  headers['Cookie'] = stub.cookie
 return requests.get(url, headers=headers, verify=False)

def OpenPathWithStub ( path , stub ) : from six . moves import http_client if ( not hasattr ( stub , 'scheme' ) ) : raise vmodl . fault . NotSupported ( ) elif ( stub . scheme == http_client . HTTPConnection ) : protocol = 'http' elif ( stub . scheme == http_client . HTTPSConnection ) : protocol = 'https' else : raise vmodl . fault . NotSupported ( ) hostPort = stub . host url = ( '%s://%s%s' % ( protocol , hostPort , path ) ) headers = { } if stub . cookie : headers [ 'Cookie' ] = stub . cookie return requests . get ( url , headers = headers , verify = False )
open the specified path using http .