aiosfpubsub
An async Python gRPC client for the Salesforce Pub/Sub API.
https://github.com/forcedotcom/pub-sub-api/blob/main/pubsub_api.proto
install
pip install aiosfpubsub
usage
import asyncio
from aiosfpubsub import Client
from datetime import datetime
def callback(event, client):
"""
This is a callback that gets passed to the `Client.subscribe()` method.
When no events are received within a certain time period, the API's subscribe
method sends keepalive messages and the latest replay ID through this callback.
"""
if event.events:
print("Number of events received in FetchResponse: ", len(event.events))
for evt in event.events:
# Get the event payload and schema, then decode the payload
payload_bytes = evt.event.payload
json_schema = client.get_schema_json(evt.event.schema_id)
decoded_event = client.decode(json_schema, payload_bytes)
print(decoded_event)
else:
print(f"[{datetime.now():%Y-%m-%d %H:%M:%S}] The subscription is active.")
async def main():
client = Client(**{
"url": "https://login.salesforce.com",
"username": "myuser",
"password": "mypass",
"grpc_host": "api.pubsub.salesforce.com",
"grpc_port": 7443,
"api_version": "57.0"
})
client.auth()
await client.subscribe(
topic="/event/My_Event__e",
replay_type="EARLIEST",
replay_id=None,
num_requested=10,
callback=callback
)
if __name__ == "__main__":
asyncio.run(main())
Metadata
Release files for aiosfpubsub 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aiosfpubsub-0.0.6.tar.gz | 12.5 kB | Without provenance | Details for aiosfpubsub-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiosfpubsub-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for aiosfpubsub-0.0.6-py3-none-any.whl |
Total release size: 23.9 kB
Release files / aiosfpubsub-0.0.6.tar.gz
| Download URL | aiosfpubsub-0.0.6.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3933a426ca6377aff0c767da87b43d18f33c974dc750d55e12823f138959a353
|
|
BLAKE2b-256 checksum How to use checksums |
fc00058caa7a9a0edf0c662ae5d7e5827367fe7e47ad78f3eacd0b02d2538a4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.2
|
Release files / aiosfpubsub-0.0.6-py3-none-any.whl
| Download URL | aiosfpubsub-0.0.6-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e0d7ccfeb377941eb11846ba5a6a33b3ce81ac39c149c1d9b5da78f674c9bd3a
|
|
BLAKE2b-256 checksum How to use checksums |
283510229c46f98c3ac1ab04ff96316eda257261513ed7915ac908d974dd8662
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.2
|
Security for aiosfpubsub 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.