Skip to content

Instantly share code, notes, and snippets.

@wfng92
Last active September 8, 2022 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wfng92/86d6f292aae395a66f605fb1bc181365 to your computer and use it in GitHub Desktop.
Save wfng92/86d6f292aae395a66f605fb1bc181365 to your computer and use it in GitHub Desktop.
def get_filepath(filename, extension):
return f'{filename}{extension}'
def run():
with grpc.insecure_channel('localhost:50051') as channel:
...
filename = 'test'
extension = '.jpg'
filepath = get_filepath(filename, extension)
for entry_response in stub.DownloadFile(hello_pb2.MetaData(filename=filename, extension=extension)):
with open(filepath, mode="ab") as f:
f.write(entry_response.chunk_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment