Created
April 26, 2017 09:52
-
-
Save tfrench/dda0a399e6b8e92958a3e243d011bf8c to your computer and use it in GitHub Desktop.
Add compression to gRPC calls in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import grpc | |
from grpc._cython.cygrpc import CompressionAlgorithm | |
from grpc._cython.cygrpc import CompressionLevel | |
chan_ops = [('grpc.default_compression_algorithm', CompressionAlgorithm.gzip), | |
('grpc.grpc.default_compression_level', CompressionLevel.high)] | |
chan = grpc.insecure_channel("<srv_addr>:<srv_port>", chan_ops) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code taken from grpc/grpc#4078