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

Last release Documentation Status Build Coverage Maintainability Requirements Status MIT license

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.

See The Force.com streaming API developer guide for more information about the different uses cases and how configure your Salesforce organization.

Feature

  • asyncio compatible library

  • Authentication with username/password or refresh token

  • 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 for more information).

aio-sf-streaming only support Python 3.6.

Getting started

Simple use case:

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':
                break
            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:

$ pip install aio-sf-streaming

Documentation

An online documentation is available.

Evolution

The library work well for our use-case then we does not plan a lot of new features.

Contributing

If you find any problem, feel free to fill an issue. Pull-Request are also welcomed.

You can install development dependencies with:

$ pip install -e .[tests,docs]

Release history

  • v. 0.3.0: Remove date-time parsing of the replay mixin, allow client to customize ReSubscribeMixin retry conditions, allow retry conditions to extend duration.

  • v. 0.2.0: Add refresh token authentication

  • v. 0.1.1: Add documentation and initial typing information.

  • v. 0.1.0: 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.3.1.tar.gz (22.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.3.1-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for aio_sf_streaming-0.3.1.tar.gz
Algorithm Hash digest
SHA256 caf334e7bdccb7672176f82f388268326180e8fe8cc8ea41cbe6cff4700b2c53
MD5 f4e23872e578643c540cb91d188a1295
BLAKE2b-256 406d586d84d5024f03e3a2ef1261526a6eeb2838c23472c3ab3a8f660ac37bd7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aio_sf_streaming-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c92106222932badf3f97670c959862999ac649d874659ffa3e00462f4693c386
MD5 1cfa54e1576958d5375ba17f7fee3174
BLAKE2b-256 35ddcee1396497b5d61d69abd6333426ce8fe6787f8d02d318ea32f4842a5660

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