Skip to content

Latest commit

 

History

History
81 lines (48 loc) · 1.76 KB

make_http_client.md

File metadata and controls

81 lines (48 loc) · 1.76 KB

function make_http_client

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 is None.

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)

Return to the main page