---
schema_version: "1"
id: ec205a051fcc6742eae09dbc6bf9001de68d1659494fbf2f26680aadb529a8b1
title: Python Quick Start for Pub/Sub API
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/event-bus/pub-sub-api/guides/qs-python-quick-start.md
canonical_url: https://developer.salesforce.com/docs/platform/pub-sub-api/guide/qs-python-quick-start.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 36282b00c47bfde297392a3a28afc602591155061a52dabda5ead4800a0f9c75
products:
  - Pub/Sub API
  - Event Bus Docs
---
# Python Quick Start for Pub/Sub API

In this quick start, you learn how to build a Pub/Sub API client in Python. The steps walk you through generating the stub files, authenticating to Salesforce, configuring events, writing code to subscribe to events, and writing code to publish events.

**note:** The quick start provides enough instructions and code snippets so that you can build your own client. The code example uses username and password authentication for simplicity, but we recommend that you use OAuth in production apps. For more information, see [Authentication](https://developer.salesforce.com/docs/platform/pub-sub-api/guide/supported-auth.md). You can find full code examples in [https://github.com/forcedotcom/pub-sub-api](https://github.com/forcedotcom/pub-sub-api). The [Go code examples](https://github.com/forcedotcom/pub-sub-api/tree/main/go) use OAuth. The full examples aren’t intended for production use and haven’t undergone thorough functional and performance testing. You can use these examples as a starting point to build your own client.

**In this section:**

- [Step 1: Generate the Stub Files](https://developer.salesforce.com/docs/platform/pub-sub-api/guide/qs-generate-stub.md)
- [Step 2: Build the Python Client](https://developer.salesforce.com/docs/platform/pub-sub-api/guide/qs-build-python-client.md)
- [Step 3: Set Up Events](https://developer.salesforce.com/docs/platform/pub-sub-api/guide/qs-set-up-events.md)
- [Step 4: Write Code That Subscribes to an Event Channel](https://developer.salesforce.com/docs/platform/pub-sub-api/guide/qs-subscribe.md)
- [Step 5: Write Code That Publishes a Platform Event Message](https://developer.salesforce.com/docs/platform/pub-sub-api/guide/qs-publish.md)
