Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions immudb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

class ImmudbClient:

def __init__(self, immudUrl=None, rs: RootService = None, publicKeyFile: str = None, timeout=None, max_grpc_message_length=None):
def __init__(self, immudUrl=None, rs: RootService = None, publicKeyFile: str = None, timeout=None, max_grpc_message_length=None, ssl_credentials=None):
"""immudb Client

Args:
Expand All @@ -61,6 +61,9 @@ def __init__(self, immudUrl=None, rs: RootService = None, publicKeyFile: str = N
will hang until the server responds if no timeout is set.
max_grpc_message_length (int, optional): maximum size of message the
server should send. The default (4Mb) is used is no value is set.
ssl_credentials (grpc.ChannelCredentials, optional): SSL credentials
for secure channel. If provided, will override the secure
parameter.
"""
if immudUrl is None:
immudUrl = "localhost:3322"
Expand All @@ -69,9 +72,10 @@ def __init__(self, immudUrl=None, rs: RootService = None, publicKeyFile: str = N
if max_grpc_message_length:
options = [('grpc.max_receive_message_length',
max_grpc_message_length)]
self.channel = grpc.insecure_channel(immudUrl, options=options)
if ssl_credentials is not None:
self.channel = grpc.secure_channel(immudUrl, ssl_credentials, options=options)
else:
self.channel = grpc.insecure_channel(immudUrl)
self.channel = grpc.insecure_channel(immudUrl, options=options)
self._resetStub()
if rs is None:
self._rs = RootService()
Expand Down