Configuration#

The python client for Nutanix Vmm Versioned APIs can be configured with the following parameters

Parameter

Description

Required

Default Value

scheme

URI scheme for connecting to the cluster (HTTP or HTTPS using SSL/TLS)

No

https

host

IPv4/IPv6 address or FQDN of the cluster to which the client will connect to

Yes

N/A

port

Port on the cluster to which the client will connect to

No

9440

username

Username to connect to a cluster

Yes

N/A

password

Password to connect to a cluster

Yes

N/A

debug

Runs the client in debug mode if specified

No

False

verify_ssl

Verify SSL certificate of cluster the client will connect to

No

True

max_retry_attempts

Maximum number of retry attempts while connecting to the cluster

No

5

backoff_factor

A backoff factor to apply between attempts after the second try.

No

3

logger_file

File location to which debug logs are written to

No

N/A

connect_timeout

Connection timeout in milliseconds for all operations

No

30000

read_timeout

Read timeout in milliseconds for all operations

No

30000

Sample Configuration#

1config = Configuration()
2config.host = '10.19.50.27' # IPv4/IPv6 address or FQDN of the cluster
3config.port = 9440 # Port to which to connect to
4config.username = 'admin' # UserName to connect to the cluster
5config.password = 'password' # Password to connect to the cluster
6api_client = ApiClient(configuration=config)

Proxy Configuration#

1config = Configuration()
2
3# Configure the cluster as shown above
4config.proxy_scheme = "https"
5config.proxy_host = "127.0.0.1"
6config.proxy_port = 8080
7config.proxy_username = "proxy_admin"
8config.proxy_password = "proxy_password"
9api_client = ApiClient(configuration=config)

Authentication#

Nutanix APIs currently support HTTP Basic Authentication only, and the Python client can be configured using the username and password parameters to send Basic headers along with every request.

Additional Headers#

The python client can be configured to send additional headers on each request.

1client = ApiClient(configuration=config)
2client.add_default_header(header_name='Accept-Encoding', header_value='gzip, deflate, br')

Retry Mechanism#

The python client can be configured to retry requests that fail with the following status codes. The numbers of seconds before which the next retry is attempted is determined using the following formula:

{backoff factor} * (2 * ({number of retries so far} - 1))

1config = Configuration()
2config.max_retry_attempts = 3 # Max retry attempts while reconnecting on a loss of connection
3config.backoff_factor = 3 # Backoff factor to use during retry attempts
4client = ApiClient(configuration=config)