Person pb2 grpc
Client and server classes for gRPC services defined in the person.proto file.
This module is generated by the protobuf compiler plugin and demonstrates how to use gRPC in Python. It is intended for pedagogical purposes, showing how to implement and interact with gRPC services.
Note
This file is generated and should not be modified manually, except for documentation improvements.
Attributes¶
GRPC_GENERATED_VERSION = '1.73.1'
module-attribute
¶
GRPC_VERSION = grpc.__version__
module-attribute
¶
Classes¶
AddressBookService
¶
Bases: object
This class provides static methods for making calls to the AddressBook service using the experimental gRPC API.
Functions¶
AddPerson(request: person__pb2.AddPersonRequest, target: str, options: tuple[Any, ...] = tuple(), channel_credentials: grpc.ChannelCredentials | None = None, call_credentials: grpc.CallCredentials | None = None, insecure: bool = False, compression: grpc.Compression | None = None, wait_for_ready: bool | None = None, timeout: float | None = None, metadata: dict[str, Any] | None = None) -> person__pb2.AddPersonResponse
staticmethod
¶
Makes an experimental unary call to AddPerson.
PARAMETER | DESCRIPTION |
---|---|
request
|
The request message containing the new person's details.
TYPE:
|
target
|
The server address.
TYPE:
|
options
|
Call options. |
channel_credentials
|
Channel credentials.
TYPE:
|
call_credentials
|
Call credentials.
TYPE:
|
insecure
|
Whether to use an insecure channel.
TYPE:
|
compression
|
Compression option.
TYPE:
|
wait_for_ready
|
Wait for ready option.
TYPE:
|
timeout
|
Timeout for the call.
TYPE:
|
metadata
|
Metadata for the call. |
RETURNS | DESCRIPTION |
---|---|
AddPersonResponse
|
The response confirming the addition. |
Source code in examples/plugins/proto/person_pb2_grpc.py
GetPerson(request: person__pb2.GetPersonRequest, target: str, options: tuple[Any, ...] = tuple(), channel_credentials: grpc.ChannelCredentials | None = None, call_credentials: grpc.CallCredentials | None = None, insecure: bool = False, compression: grpc.Compression | None = None, wait_for_ready: bool | None = None, timeout: float | None = None, metadata: dict[str, Any] | None = None) -> person__pb2.GetPersonResponse
staticmethod
¶
Makes an experimental unary call to GetPerson.
PARAMETER | DESCRIPTION |
---|---|
request
|
The request message containing the person's ID.
TYPE:
|
target
|
The server address.
TYPE:
|
options
|
Call options. |
channel_credentials
|
Channel credentials.
TYPE:
|
call_credentials
|
Call credentials.
TYPE:
|
insecure
|
Whether to use an insecure channel.
TYPE:
|
compression
|
Compression option.
TYPE:
|
wait_for_ready
|
Wait for ready option.
TYPE:
|
timeout
|
Timeout for the call.
TYPE:
|
metadata
|
Metadata for the call. |
RETURNS | DESCRIPTION |
---|---|
GetPersonResponse
|
The response containing the person's details. |
Source code in examples/plugins/proto/person_pb2_grpc.py
ListPeople(request: person__pb2.ListPeopleRequest, target: str, options: tuple[Any, ...] = tuple(), channel_credentials: grpc.ChannelCredentials | None = None, call_credentials: grpc.CallCredentials | None = None, insecure: bool = False, compression: grpc.Compression | None = None, wait_for_ready: bool | None = None, timeout: float | None = None, metadata: dict[str, Any] | None = None) -> person__pb2.ListPeopleResponse
staticmethod
¶
Makes an experimental unary call to ListPeople.
PARAMETER | DESCRIPTION |
---|---|
request
|
The request message (typically empty).
TYPE:
|
target
|
The server address.
TYPE:
|
options
|
Call options. |
channel_credentials
|
Channel credentials.
TYPE:
|
call_credentials
|
Call credentials.
TYPE:
|
insecure
|
Whether to use an insecure channel.
TYPE:
|
compression
|
Compression option.
TYPE:
|
wait_for_ready
|
Wait for ready option.
TYPE:
|
timeout
|
Timeout for the call.
TYPE:
|
metadata
|
Metadata for the call. |
RETURNS | DESCRIPTION |
---|---|
ListPeopleResponse
|
The response containing a list of people. |
Source code in examples/plugins/proto/person_pb2_grpc.py
AddressBookServiceServicer
¶
Bases: object
Server-side implementation base for the AddressBook gRPC service.
This class should be subclassed to provide concrete implementations of the service methods. Each method receives a request and a context, and should return the appropriate response.
Functions¶
AddPerson(request: person__pb2.AddPersonRequest, context: grpc.ServicerContext) -> person__pb2.AddPersonResponse
¶
Adds a new person to the address book.
PARAMETER | DESCRIPTION |
---|---|
request
|
The request message containing the new person's details.
TYPE:
|
context
|
The context for the RPC call.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
AddPersonResponse
|
The response confirming the addition. |
Source code in examples/plugins/proto/person_pb2_grpc.py
GetPerson(request: person__pb2.GetPersonRequest, context: grpc.ServicerContext) -> person__pb2.GetPersonResponse
¶
Gets a person by their unique ID.
PARAMETER | DESCRIPTION |
---|---|
request
|
The request message containing the person's ID.
TYPE:
|
context
|
The context for the RPC call.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GetPersonResponse
|
The response containing the person's details. |
Source code in examples/plugins/proto/person_pb2_grpc.py
ListPeople(request: person__pb2.ListPeopleRequest, context: grpc.ServicerContext) -> person__pb2.ListPeopleResponse
¶
Lists all people in the address book.
PARAMETER | DESCRIPTION |
---|---|
request
|
The request message (typically empty).
TYPE:
|
context
|
The context for the RPC call.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ListPeopleResponse
|
The response containing a list of people. |
Source code in examples/plugins/proto/person_pb2_grpc.py
AddressBookServiceStub(channel: grpc.Channel)
¶
Bases: object
Stub client for the AddressBook gRPC service.
This class provides client-side methods for interacting with the AddressBook service. It is typically instantiated with a gRPC channel and used to make remote procedure calls.
PARAMETER | DESCRIPTION |
---|---|
channel
|
The gRPC channel through which to make calls.
TYPE:
|
Source code in examples/plugins/proto/person_pb2_grpc.py
Attributes¶
AddPerson = channel.unary_unary('/person.AddressBookService/AddPerson', request_serializer=(person__pb2.AddPersonRequest.SerializeToString), response_deserializer=(person__pb2.AddPersonResponse.FromString), _registered_method=True)
instance-attribute
¶
GetPerson = channel.unary_unary('/person.AddressBookService/GetPerson', request_serializer=(person__pb2.GetPersonRequest.SerializeToString), response_deserializer=(person__pb2.GetPersonResponse.FromString), _registered_method=True)
instance-attribute
¶
ListPeople = channel.unary_unary('/person.AddressBookService/ListPeople', request_serializer=(person__pb2.ListPeopleRequest.SerializeToString), response_deserializer=(person__pb2.ListPeopleResponse.FromString), _registered_method=True)
instance-attribute
¶
Functions¶
add_AddressBookServiceServicer_to_server(servicer: AddressBookServiceServicer, server: grpc.Server) -> None
¶
Registers the AddressBookServiceServicer with a gRPC server.
PARAMETER | DESCRIPTION |
---|---|
servicer
|
The service implementation to add to the server. |
server
|
The gRPC server to which the service will be added.
TYPE:
|