On Thu, Sep 6, 2018 at 8:03 AM Mark <[email protected]> wrote: > I have asked this question in SO > https://stackoverflow.com/questions/52197359/sending-back-a-file-stream-from-grpc-python-server?noredirect=1#comment91343967_52197359 > > But I would like to try my luck here also... > > I have a service that needs to return a filestream to the calling client > so I have created this proto file. > > service Sample { > rpc getSomething(Request) returns (stream Response){} > } > > message Request { > > } > > message Response { > bytes data = 1; > } > > When the server receives this, it needs to read some source.txt file and > then write it back to the client > as a byte stream. Just would like to ask is this the proper way to do > this in a Python GRPC server? > > fileName = "source.txt" > with open(file_name, 'r') as content_file: > content = content_file.read() > response.data = content.encode() > yield response > I cannot find any examples related to this that is written in Python. > > I am a newbie GRPC/Python Coder also, I just need to implement this > functionality so please bear with me. >
I've responded on StackOverflow. <https://stackoverflow.com/a/52462430/4621164> -Nathaniel -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CAEOYnASRews7EycZAG63tLReKoHC91QZczBc-7qXKe%3D0brgK_A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
smime.p7s
Description: S/MIME Cryptographic Signature
