make_http_client(url, tls_config)
Description:
Creates HttpClient
object.
Args:
-
url
- Model Server URL as a string in format<address>:<port>
-
tls_config
(optional): dictionary with TLS configuration. The accepted format is:{ "client_key_path": <Path to client key file>, "client_cert_path": <Path to client certificate file>, "server_cert_path": <Path to server certificate file> }
With following types accepted:
Key Value type client_key_path string client_cert_path string server_cert_path string By default TLS is not used and
tls_config
value isNone
.
Returns:
HttpClient
object
Raises:
ValueError, TypeError
: if provided config is invalid.
Examples:
Create minimal HttpClient
:
from ovmsclient import make_http_client
client = make_http_client("localhost:9000")
Create HttpClient
with TLS:
from ovmsclient import make_http_client
tls_config = {
"tls_config": {
"client_key_path": "/opt/tls/client.key",
"client_cert_path": "/opt/tls/client.crt",
"server_cert_path": "/opt/tls/server.crt"
}
}
client = make_http_client("localhost:9000", tls_config=tls_config)