Step 1: Generate the Stub Files

Prerequisites

  1. Install the Python package manager by running this command in the terminal.

    You can use a different package manager.

  2. Clone the GitHub repository for Pub/Sub API from https://github.com/forcedotcom/pub-sub-api. The proto file name is pubsub_api.proto.

  3. Switch to the python directory.

  4. Generate the stubs for the Pub/Sub API by running this command from the cloned directory.

    This command generates two files in your current directory: pubsub_api_pb2.py and pubsub_api_pb2_grpc.py. It also generates client and server code and protocol buffer code for populating, serializing, and retrieving message types.