Salesforce Streaming API client for asyncio
Project description
aiosfstream
aiosfstream is a Salesforce Streaming API client for asyncio. It can be used to receive push notifications about changes on Salesforce objects or notifications of general events sent through the Streaming API.
For detailed guidance on how to work with PushTopics or how to create Generic Streaming Channels please consult the Streaming API documentation.
Features
- Supported authentication types:
using a username and password
using a refresh token
- Subscribe to and receive messages on:
Support for durable messages and replay of events
Automatic recovery from replay errors
Usage
import asyncio
from aiosfstream import SalesforceStreamingClient
async def stream_events():
# connect to Streaming API
async with SalesforceStreamingClient(
consumer_key="<consumer key>",
consumer_secret="<consumer secret>",
username="<username>",
password="<password>") as client:
# subscribe to topics
await client.subscribe("/topic/one")
await client.subscribe("/topic/two")
# listen for incoming messages
async for message in client:
topic = message["channel"]
data = message["data"]
print(f"{topic}: {data}")
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(stream_events())
Changelog
0.1.0 (2018-04-26)
- Supported authentication types:
using a username and password
using a refresh token
- Subscribe to and receive messages on:
Support for durable messages and replay of events
Automatic recovery from replay errors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for aiosfstream-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94198110aad3051afd3935e09c8dd13240ea6720fd1f8417a04acbd59ea6313d |
|
MD5 | 8ff989073b2f38868942be0e00d3ffa7 |
|
BLAKE2b-256 | 0c6f275448f4b449fa4356fdacf1d27c6aff01121b56b085c7138ae535e5b906 |