Skip to main content

aio_sf_streaming is a simple Python 3.6 asyncio library allowing to connect and receive live notifications from Salesforce.

Project description


aio_sf_streaming
================

*aio_sf_streaming* is a simple Python 3.6 asyncio library allowing to connect
and receive live notifications from Salesforce. This library is provided to
you by `papernest <http://www.papernest.com>`_.

See `The Force.com streaming API developer guide <https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/intro_stream.htm>`_
for more information about the different uses cases and how configure your
Salesforce organization.


Feature
-------

- `asyncio <https://docs.python.org/3/library/asyncio.html>`_ compatible library
- Subscribe to push topics and custom events
- Receive events pushed by Salesforce
- Auto-reconnect after too many time of inactivity
- Replay support: replay events missed while your client is disconnected (see
`Force.com documentation <https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/using_streaming_api_stateless.htm>`_
for more information).

*aio_sf_streaming* only support Python 3.6 for now.


Getting started
---------------

Simple use case:

.. code-block:: python
import asyncio
from aio_sf_streaming import SimpleSalesforceStreaming

async def print_event():
# Create client and connect
async with SimpleSalesforceStreaming(
username='my-username',
password='my-password',
client_id='my-client-id',
client_secret='my-client-secret') as client:
# Subscribe to some push topics
await client.subscribe('/topic/Foo')
await client.subscribe('/topic/Bar')
async for message in client.events():
print(message)
# client will wait indefinitely, you can ask to exit
if message['channel'] == '/topic/Bar':
await client.ask_stop()
else:
# You can unsubscribe when you want, too
await client.unsubscribe('/topic/Foo')

loop = asyncio.get_event_loop()
loop.run_until_complete(print_event())


Installation
------------

Simply use ``pip``:

.. code-block:: bash

$ pip install aio_sf_streaming


Documentation
-------------

A online documentation is available at .


Evolution
---------

The library work well for our use-case then we does not plan a lot of new
features. The only planned feature is the addition of the OAuth2 browser flow
`refresh_token` for authentication instead of user name and passwords.


Release history
---------------

**v. 0.1**: Initial release


License
=======

``aio_sf_streaming`` is offered under the MIT license.



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aio_sf_streaming-0.1.0.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aio_sf_streaming-0.1.0-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file aio_sf_streaming-0.1.0.tar.gz.

File metadata

File hashes

Hashes for aio_sf_streaming-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8dbda31b2b4d33ca0849383ae6438204358fcec925582390c0d915f08b99cc4d
MD5 f0700f8110fc13a9a153b9154244ba2a
BLAKE2b-256 f68ddbf894f0a4b6f01dc9639a2e891fc88d4d231d8fc9061a00ac52acfad302

See more details on using hashes here.

File details

Details for the file aio_sf_streaming-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aio_sf_streaming-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eeb993486fccacade21cdb1702ec6ec0b4c6816b115ee8be1972af6b7df7780c
MD5 2c97cb52b700f05b5cb41e620ba74cce
BLAKE2b-256 c24eb1f71de410dbd3c5fa074191185419432a215e1e713bf068a141f3478427

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page