File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -841,7 +841,7 @@ def _create_experimental_host_transport(
841841 elif ca_certificate :
842842 with open (ca_certificate , "rb" ) as f :
843843 ca_cert = f .read ()
844- if client_certificate is not None and client_key is not None :
844+ if client_certificate and client_key :
845845 with open (client_certificate , "rb" ) as f :
846846 client_cert = f .read ()
847847 with open (client_key , "rb" ) as f :
@@ -851,12 +851,12 @@ def _create_experimental_host_transport(
851851 private_key = private_key ,
852852 certificate_chain = client_cert ,
853853 )
854- elif client_certificate is None and client_key is None :
855- ssl_creds = grpc .ssl_channel_credentials (root_certificates = ca_cert )
856- else :
854+ elif client_certificate or client_key :
857855 raise ValueError (
858856 "Both client_certificate and client_key must be provided for mTLS connection"
859857 )
858+ else :
859+ ssl_creds = grpc .ssl_channel_credentials (root_certificates = ca_cert )
860860 channel = grpc .secure_channel (experimental_host , ssl_creds )
861861 else :
862862 raise ValueError (
You can’t perform that action at this time.
0 commit comments