From the course: gRPC in Python

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Running the server

Running the server

- [Male Instructor] Let's run the grpc generated server. So, in our code, first we import a ThreadPoolExecutor. This is going to be used to run the requests. And we are going to import uuid4 because we're going to generate new IDs. We import grpc, and we import our internal logger. We also import the protocol buffers and the generated grpc definitions. Uuid is going to generate a new_ride_id using uuid4. And here we have our class. This is called Rides from the RidesServicer that is defined by the generated grpc code. We override the start request, which gets the request and a context. We're going to log what is the request, generate a new ID, and return a StartResponse with the ID. Once we have the server ready, we can run it. We import our configuration system and then create a generic grpc server with a ThreadPoolExecutor. Next, we register our server inside the grpc server. We define an address and add an insecure port.…

Contents