regenerated protos
This commit is contained in:
parent
933a05205f
commit
5cdc65777a
3 changed files with 61 additions and 102 deletions
File diff suppressed because one or more lines are too long
|
@ -283,8 +283,8 @@ class CurrencyServiceStub(object):
|
|||
)
|
||||
self.Convert = channel.unary_unary(
|
||||
'/hipstershop.CurrencyService/Convert',
|
||||
request_serializer=demo__pb2.ConversionRequest.SerializeToString,
|
||||
response_deserializer=demo__pb2.ConversionResponse.FromString,
|
||||
request_serializer=demo__pb2.CurrencyConversionRequest.SerializeToString,
|
||||
response_deserializer=demo__pb2.Money.FromString,
|
||||
)
|
||||
|
||||
|
||||
|
@ -317,8 +317,8 @@ def add_CurrencyServiceServicer_to_server(servicer, server):
|
|||
),
|
||||
'Convert': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Convert,
|
||||
request_deserializer=demo__pb2.ConversionRequest.FromString,
|
||||
response_serializer=demo__pb2.ConversionResponse.SerializeToString,
|
||||
request_deserializer=demo__pb2.CurrencyConversionRequest.FromString,
|
||||
response_serializer=demo__pb2.Money.SerializeToString,
|
||||
),
|
||||
}
|
||||
generic_handler = grpc.method_handlers_generic_handler(
|
||||
|
|
|
@ -9,15 +9,14 @@ import os
|
|||
class RecommendationService(demo_pb2_grpc.RecommendationServiceServicer):
|
||||
def ListRecommendations(self, request, context):
|
||||
max_responses = 5
|
||||
print("handling request")
|
||||
|
||||
# get list of products
|
||||
cat_response = stub.ListProducts(demo_pb2.Empty())
|
||||
num_prodcuts = len(cat_response.products)
|
||||
|
||||
indices = random.sample(range(num_prodcuts), min(max_responses, num_prodcuts))
|
||||
prod_list = [str(cat_response.products[i].id) for i in indices]
|
||||
print(indices, prod_list)
|
||||
prod_list = [cat_response.products[i].id for i in indices]
|
||||
print("handling request: {}".format(prod_list))
|
||||
|
||||
response = demo_pb2.ListRecommendationsResponse()
|
||||
response.product_ids.extend(prod_list)
|
||||
|
|
Loading…
Reference in a new issue