pull/21504/head
Richard Belleville 5 years ago
parent 13a4f1d7d3
commit 135b94913f
  1. 3
      examples/python/helloworld/greeter_client_with_options.py
  2. 4
      examples/python/interceptors/default_value/greeter_client.py
  3. 4
      examples/python/interceptors/headers/greeter_client.py
  4. 4
      examples/python/interceptors/headers/greeter_server.py
  5. 4
      examples/python/metadata/metadata_client.py
  6. 4
      examples/python/metadata/metadata_server.py
  7. 8
      examples/python/multiplex/multiplex_client.py
  8. 17
      examples/python/multiplex/multiplex_server.py
  9. 3
      examples/python/multiplex/route_guide_resources.py
  10. 4
      examples/python/route_guide/route_guide_client.py
  11. 3
      examples/python/route_guide/route_guide_resources.py
  12. 7
      examples/python/route_guide/route_guide_server.py

@ -35,8 +35,7 @@ def run():
stub = services.GreeterStub(channel)
# Timeout in seconds.
# Please refer gRPC Python documents for more detail. https://grpc.io/grpc/python/grpc.html
response = stub.SayHello(
protos.HelloRequest(name='you'), timeout=10)
response = stub.SayHello(protos.HelloRequest(name='you'), timeout=10)
print("Greeter client received: " + response.message)

@ -18,8 +18,8 @@ import logging
import grpc
protos, services = grpc.protos_and_services("protos/helloworld.proto",
include_paths=["../../.."])
protos, services = grpc.protos_and_services(
"protos/helloworld.proto", include_paths=["../../.."])
import default_value_client_interceptor

@ -18,8 +18,8 @@ import logging
import grpc
protos, services = grpc.protos_and_services("protos/helloworld.protos",
include_paths=["../../.."])
protos, services = grpc.protos_and_services(
"protos/helloworld.protos", include_paths=["../../.."])
import header_manipulator_client_interceptor

@ -18,8 +18,8 @@ import logging
import grpc
protos, services = grpc.protos_and_services("protos/helloworld.protos",
include_paths=["../../.."])
protos, services = grpc.protos_and_services(
"protos/helloworld.protos", include_paths=["../../.."])
from request_header_validator_interceptor import RequestHeaderValidatorInterceptor

@ -18,8 +18,8 @@ import logging
import grpc
protos, services = grpc.protos_and_services("protos/helloworld.proto",
include_paths=["../.."])
protos, services = grpc.protos_and_services(
"protos/helloworld.proto", include_paths=["../.."])
def run():

@ -19,8 +19,8 @@ import logging
import grpc
protos, services = grpc.protos_and_services("protos/helloworld.proto",
include_paths=["../.."])
protos, services = grpc.protos_and_services(
"protos/helloworld.proto", include_paths=["../.."])
class Greeter(services.GreeterServicer):

@ -21,10 +21,10 @@ import logging
import grpc
hw_protos, hw_services = grpc.protos_and_services("protos/helloworld.proto",
include_paths=["../.."])
rg_protos, rg_services = grpc.protos_and_services("protos/route_guide.proto",
include_paths=["../.."])
hw_protos, hw_services = grpc.protos_and_services(
"protos/helloworld.proto", include_paths=["../.."])
rg_protos, rg_services = grpc.protos_and_services(
"protos/route_guide.proto", include_paths=["../.."])
import route_guide_resources

@ -20,10 +20,10 @@ import logging
import grpc
hw_protos, hw_services = grpc.protos_and_services("protos/helloworld.proto",
include_paths=["../.."])
rg_protos, rg_services = grpc.protos_and_services("protos/route_guide.proto",
include_paths=["../.."])
hw_protos, hw_services = grpc.protos_and_services(
"protos/helloworld.proto", include_paths=["../.."])
rg_protos, rg_services = grpc.protos_and_services(
"protos/route_guide.proto", include_paths=["../.."])
import route_guide_resources
@ -59,8 +59,7 @@ def _get_distance(start, end):
class _GreeterServicer(hw_services.GreeterServicer):
def SayHello(self, request, context):
return hw_protos.HelloReply(
message='Hello, {}!'.format(request.name))
return hw_protos.HelloReply(message='Hello, {}!'.format(request.name))
class _RouteGuideServicer(rg_services.RouteGuideServicer):
@ -121,10 +120,8 @@ class _RouteGuideServicer(rg_services.RouteGuideServicer):
def serve():
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
hw_services.add_GreeterServicer_to_server(_GreeterServicer(),
server)
rg_services.add_RouteGuideServicer_to_server(
_RouteGuideServicer(), server)
hw_services.add_GreeterServicer_to_server(_GreeterServicer(), server)
rg_services.add_RouteGuideServicer_to_server(_RouteGuideServicer(), server)
server.add_insecure_port('[::]:50051')
server.start()
server.wait_for_termination()

@ -17,8 +17,7 @@ import json
import grpc
protos = grpc.protos("protos/route_guide.proto",
include_paths=["../.."])
protos = grpc.protos("protos/route_guide.proto", include_paths=["../.."])
def read_route_guide_database():

@ -20,8 +20,8 @@ import logging
import grpc
protos, services = grpc.protos_and_services("protos/route_guide.proto",
include_paths=["../.."])
protos, services = grpc.protos_and_services(
"protos/route_guide.proto", include_paths=["../.."])
import route_guide_resources

@ -16,8 +16,7 @@
import json
import grpc
protos = grpc.protos("protos/route_guide.proto",
include_paths=["../.."])
protos = grpc.protos("protos/route_guide.proto", include_paths=["../.."])
def read_route_guide_database():

@ -20,8 +20,8 @@ import logging
import grpc
protos, services = grpc.protos_and_services("protos/route_guide.proto",
include_paths=["../.."])
protos, services = grpc.protos_and_services(
"protos/route_guide.proto", include_paths=["../.."])
import route_guide_resources
@ -113,8 +113,7 @@ class RouteGuideServicer(services.RouteGuideServicer):
def serve():
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
services.add_RouteGuideServicer_to_server(
RouteGuideServicer(), server)
services.add_RouteGuideServicer_to_server(RouteGuideServicer(), server)
server.add_insecure_port('[::]:50051')
server.start()
server.wait_for_termination()

Loading…
Cancel
Save