gRPC extensions for Google Cloud Platform
Project description
Package for gRPC-GCP Python.
Installation
gRPC-GCP Python is available wherever gRPC is available.
From PyPI
If you are installing locally…
$ pip install grpcio-gcp
Else system wide (on Ubuntu)…
$ sudo pip install grpcio-gcp
Usage
Create a config file (e.g. spanner.grpc.config) defining API configuration, with ChannelPoolConfig and MethodConfig.
channel_pool: {
max_size: 10
max_concurrent_streams_low_watermark: 1
}
method: {
name: "/google.spanner.v1.Spanner/CreateSession"
affinity: {
command: BIND
affinity_key: "name"
}
}
method: {
name: "/google.spanner.v1.Spanner/GetSession"
affinity: {
command: BOUND
affinity_key: "name"
}
}
method: {
name: "/google.spanner.v1.Spanner/DeleteSession"
affinity: {
command: UNBIND
affinity_key: "name"
}
}
Load configuration file to ApiConfig object.
import google.protobuf.text_format
config = grpc_gcp.api_config_from_text_pb(
pkg_resources.resource_string(__name__, 'spanner.grpc.config'))
Create channel pool using grpc_gcp.
import grpc_gcp
import grpc
credentials = grpc.ssl_channel_credentials()
# Add api config key-value pair to options
options = [(grpc_gcp.API_CONFIG_CHANNEL_ARG, config)]
channel_pool = grpc_gcp.secure_channel(target, credentials, options)
The generated channel pool is inherited from the original grpc.Channel, with underlying support for multiple grpc channels.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grpcio-gcp-0.2.2.tar.gz.
File metadata
- Download URL: grpcio-gcp-0.2.2.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/2.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e292605effc7da39b7a8734c719afb12ec4b5362add3528d8afad3aa3aa9057c
|
|
| MD5 |
3fcbdecd5d273ed29778af188b77e597
|
|
| BLAKE2b-256 |
3ca269a79b928e4a6abb5979945be9382f8aaf4580a7496ad4389371bbc0c9eb
|
File details
Details for the file grpcio_gcp-0.2.2-py2.py3-none-any.whl.
File metadata
- Download URL: grpcio_gcp-0.2.2-py2.py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/2.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ef8e8531eab11356a3eb4c5b84e79e0d923d6782d19e1b1a45e1cabe4e783d7
|
|
| MD5 |
da34c9cd83e0c072208418b197bae37c
|
|
| BLAKE2b-256 |
ba831f1095815be0de19102df41e250ebbd7dae97d7d14e22c18da07ed5ed9d4
|