php - how to connect with grpc server with some metadata in python? -
i need connect grpc server metadata ,such username , password.from grpc docs,the php code clear,i think code work:
$client = new routeguide\routeguideclient('test.yintongzhibo.com:9002', [ 'credentials' => grpc\channelcredentials::createssl(file_get_contents("xxx.pem")), 'update_metadata' => $metaprocessor, 'grpc.ssl_target_name_override' => 'test.yintongzhibo.com',]); $metaprocessor = function($metadata,$client = []){ $values = $metadata; $values[username] = ['xxx']; $values[password] = ['yyy']; return $values;} list($resp,$status) = $client->getmarketdata(request)->wait();
but need achieve same thing in python.python docs not clear,so how write python code same thing php code does?
stubs have metadata field.
ex: stub.sayhello(helloworld_pb2.hellorequest(name='you'), metadata=[('key','value')])
Comments
Post a Comment