2.7.4.1. Python Server Implementation

Single Argument Method Implementation. 

class MyServicer (AnExampleServiceServicer):
    def OneToOne (self, request, context):

        # Method implementation goes here ...

        return response

Server Initialization. 

server = grpc.server (
    futures.ThreadPoolExecutor (
        max_workers = SERVER_THREAD_COUNT))
add_AnExampleServiceServicer_to_server (MyServicer (), server)
server.add_insecure_port ("localhost:8888")
server.start ()

server.wait_for_termination ()