Last active
February 28, 2019 09:49
-
-
Save kooba/246252cca2ea363220ff79f88deb29a2 to your computer and use it in GitHub Desktop.
nameko-grpc-examples-1
This file contains 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
from nameko_grpc.entrypoint import Grpc | |
from products import dependencies | |
from products.products_pb2 import Product | |
from products.products_pb2_grpc import productsStub | |
grpc = Grpc.implementing(productsStub) | |
class ProductsService: | |
name = "products" | |
storage = dependencies.Storage() | |
@grpc | |
def get_product(self, request, context): | |
product = self.storage.get(request.id) | |
return Product(**product) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment