aio_sf_streaming是一个简单的python 3.6异步库,允许连接和接收来自salesforce的实时通知。
aio-sf-streaming的Python项目详细描述
AIO SF流媒体
aio sf streaming是一个简单的python 3.6异步库,允许连接 并接收Salesforce的实时通知。这个图书馆提供给 你靠papernest。
见The Force.com streaming API developer guide 有关不同用例以及如何配置 Salesforce组织。
功能
- asyncio兼容库
- 使用用户名/密码或刷新令牌进行身份验证
- 订阅推送主题和自定义事件
- 接收Salesforce推送的事件
- 过多时间不活动后自动重新连接
- 重播支持:客户端断开连接时错过重播事件(请参阅 Force.com documentation 更多信息)。
aio sf streaming仅支持python 3.6。
开始
简单用例:
importasynciofromaio_sf_streamingimportSimpleSalesforceStreamingasyncdefprint_event():# Create client and connectasyncwithSimpleSalesforceStreaming(username='my-username',password='my-password',client_id='my-client-id',client_secret='my-client-secret')asclient:# Subscribe to some push topicsawaitclient.subscribe('/topic/Foo')awaitclient.subscribe('/topic/Bar')asyncformessageinclient.events():print(message)# client will wait indefinitely, you can ask to exitifmessage['channel']=='/topic/Bar':breakelse:# You can unsubscribe when you want, tooawaitclient.unsubscribe('/topic/Foo')loop=asyncio.get_event_loop()loop.run_until_complete(print_event())
安装
只需使用pip:
$ pip install aio-sf-streaming
进化
对于我们的用例,这个库工作得很好,因此我们没有计划很多新的 特征。
贡献
如果你发现任何问题,请随意填写。拉取请求也是 欢迎。
您可以使用以下命令安装开发依赖项:
$ pip install -e .[tests,docs]
发布历史
- v.0.2.0:添加刷新令牌身份验证
- v.0.1.1:添加文档和初始键入信息。
- v.0.1.0:初始版本。
许可证
aio-sf-streaming根据麻省理工学院的许可证提供。