Skip to content

Instantly share code, notes, and snippets.

@koradon
Created June 2, 2022 10:03
Show Gist options
  • Save koradon/8742ab654c874caa4ca44e9de5411ee7 to your computer and use it in GitHub Desktop.
Save koradon/8742ab654c874caa4ca44e9de5411ee7 to your computer and use it in GitHub Desktop.
import grpc
from protos.user_store_pb2 import User, UserResponse, UserEmailRequest,
from protos.user_store_pb2_grpc import UserStoreServicer
class UserStoreServicer(UserStoreServicer):
def GetUserDataByEmail(self, request: UserEmailRequest, context):
user = … # your code for fetching the user data
return UserResponse(
user=User(
email=user.email,
firstname=user.firstname,
lastname=user.lastname
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment