### Navigation

- index
- modules |
- next |
- previous |
- vSphere Automation SDK for Python 6.5.0 documentation »
- vmware Package »
- vapi Package »
- protocol Package »
- client Package »

# rpc Package

## `rpc` Package

## `http_provider` Module

Http protocol rpc provider

class `vmware.vapi.protocol.client.rpc.http_provider.``GzipReader`(rfile, encoding=1, read_chunk_size=512)

  Bases: `object`

  Gzip reader

  Gzip reader init

  Parameters: | rfile (`file`) – file object to read from encoding (`int` (`GzipReader.GZIP` or `GzipReader.DEFLATE`)) – Zip stream encoding enum read_chunk_size (`int`) – Read chunk size

  `DEFLATE` = 2
  `GZIP` = 1
  `read`(num_bytes=-1)

    Parameters: | num_bytes (`int`) – Number of decompressed bytes to read
    Return type: | `bytes`
    Returns: | Decompressed data (len up to num_bytes)

class `vmware.vapi.protocol.client.rpc.http_provider.``HttpRpcProvider`(ssl_args, url)

  Bases: `vmware.vapi.protocol.client.rpc.provider.RpcProvider`

  http rpc provider

  http rpc provider init

  Parameters: | ssl_args (`dict`) – ssl arguments url (`str`) – url to connected to

  `connect`()

    Return type: | `vmware.vapi.protocol.client.rpc.provider.RpcProvider`
    Returns: | http rpc provider

  static `disable_nagle`(conn)

    disable nagle algorithm for a connection

    Parameters: | conn (`http_client.HTTPConnection`) – http connection

  `disconnect`()
  `do_request`(request_ctx, request)

    Do rpc request

    Parameters: | request_ctx (`dict` of `str`, `str`) – Request context dictionary. The valid key/value pairs are: content-type, {as in http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html 14.17} request (`str`) – The request body
    Return type: | `tuple` of (`dict` of `str`, `str`), `str`
    Returns: | Tuple of (response_ctx, response_body) where response_ctx: Response context dictionary. The valid key/value pairs are: content-type, {as in http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html 14.17} response: The response body

  static `is_connection_dropped`(conn)

    Returns True if the connection is dropped and should be closed.

    Parameters: | conn (`http_client.HTTPConnection`) – HTTP connection object
    Return type: | `bool`
    Returns: | True if the connection is dropped, False otherwise

class `vmware.vapi.protocol.client.rpc.http_provider.``HttpsConnection`(*args, **kwargs)

  Bases: `httplib.HTTPSConnection`

  Internal version of https connection

  Internal version of https connection init

  Parameters: | args (`tuple`) – position parameters to `http_client.HTTPSConnection` kwargs (`dict`) – key parameters to `http_client.HTTPSConnection`

  `connect`()

class `vmware.vapi.protocol.client.rpc.http_provider.``UnixSocketConnection`(path)

  Bases: `httplib.HTTPConnection`

  Variant of http_client.HTTPConnection that supports HTTP connections over Unix domain sockets.

  Initialize a Unix domain socket HTTP connection

  The HTTPConnection __init__ method expects a single argument, which it interprets as the host to connect to. For this class, we instead interpret the parameter as the filesystem path of the Unix domain socket.

  Parameters: | path (`str`) – Unix domain socket path

  `connect`()

    Override the HTTPConnection connect method to connect to a Unix domain socket. Obey the same contract as HTTPConnection.connect which puts the socket in self.sock.

`vmware.vapi.protocol.client.rpc.http_provider.``patch_http_response_read`(func)

  Wrapper function to patch the http read method to return the partial data when the server doesn’t send a zero length chunk

## `provider` Module

rpc provider interface

class `vmware.vapi.protocol.client.rpc.provider.``RpcProvider`

  Bases: `object`

  Rpc provider interface

  Rpc provider interface init

  `connect`()

    Return type: | `vmware.vapi.protocol.client.rpc.provider.RpcProvider`
    Returns: | a rpc provider

  `disconnect`()
  `do_request`(request_ctx, request)

    Do rpc request

    Parameters: | request_ctx (`dict` of `str`, `str`) – Request context dictionary. The valid key/value pairs are: content-type, {as in http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html 14.17} request (`str`) – The request body
    Return type: | `tuple` of (`dict` of `str`, `str`), `str`
    Returns: | Tuple of (response_ctx, response_body) where response_ctx: Response context dictionary. The valid key/value pairs are: content-type, {as in http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html 14.17} response: The response body

## `provider_factory` Module

rpc provider factory

class `vmware.vapi.protocol.client.rpc.provider_factory.``RpcProviderFactory`

  Bases: `object`

  Rpc provider factory

  Rpc provider factory init

  `get_rpc_provider`(rpc_provider_name, *args, **kwargs)

    Create rpc provider

    Parameters: | rpc_provider_name – args (`tuple`) – position parameters to rpc provider constructor kwargs (`dict`) – key parameters to rpc provider constructor
    Return type: | `vmware.vapi.protocol.client.rpc.provider.RpcProvider`
    Returns: | Rpc provider object

## `requests_provider` Module

RPC Provider using Requests Library

class `vmware.vapi.protocol.client.rpc.requests_provider.``RequestsRpcProvider`(session, url, timeout, pool_size)

  Bases: `vmware.vapi.protocol.client.rpc.provider.RpcProvider`

  vAPI RPC provider using requests library

  Initialize RequestsRpcProvider

  Parameters: | session (`requests.Session`) – Session object msg_protocol (`str`) – Message protocol to be used for the connection. Valid values are ‘json’. url (`str`) – HTTP(S) URL to be used timeout (`int`) – Request timeout pool_size (`int`) – Connection pool size to be used

  `connect`()

    Return type: | `vmware.vapi.protocol.client.rpc.provider.RpcProvider`
    Returns: | http rpc provider

  `disconnect`()
  `do_request`(request_ctx, request)

    Do rpc request

    Parameters: | request_ctx (`dict` of `str`, `str`) – Request context dictionary. The valid key/value pairs are: content-type, {as in http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html 14.17} request (`str`) – The request body
    Return type: | `tuple` of (`dict` of `str`, `str`), `str`
    Returns: | Tuple of (response_ctx, response_body) where response_ctx: Response context dictionary. The valid key/value pairs are: content-type, {as in http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html 14.17} response: The response body

### Navigation

- index
- modules |
- next |
- previous |
- vSphere Automation SDK for Python 6.5.0 documentation »
- vmware Package »
- vapi Package »
- protocol Package »
- client Package »