Skip to content

Latest commit

 

History

History
92 lines (59 loc) · 1.93 KB

File metadata and controls

92 lines (59 loc) · 1.93 KB

function make_grpc_client

make_grpc_client(config)

Aliases:

Description:

Creates GrpcClient object.

Args:

  • config: Python dictionary with client configuration. The accepted format is:

    {
        "address": <IP address of the serving>,                  
        "port": <Port number used by the gRPC interface of the server>,                      
        "tls_config": {                      
            "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
    address string
    port integer
    client_key_path string
    client_cert_path string
    server_cert_path string

    The minimal config must contain address and port.

Returns: GrpcClient object

Raises:

  • ValueError, TypeError: if provided config is invalid.

Examples:

Create minimal GrpcClient:

config = {
    "address": "localhost",
    "port": 9000
}
client = make_grpc_client(config)

Create GrpcClient with TLS:

config = {
    "address": "localhost",
    "port": 9000,
    "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_grpc_client(config)

Return to the main page