Skip to content

Instantly share code, notes, and snippets.

@kooba
Last active February 28, 2019 09:49
Show Gist options
  • Save kooba/246252cca2ea363220ff79f88deb29a2 to your computer and use it in GitHub Desktop.
Save kooba/246252cca2ea363220ff79f88deb29a2 to your computer and use it in GitHub Desktop.
nameko-grpc-examples-1
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