aws和pusher的异步客户机
pulsar-cloud的Python项目详细描述
Badges: | |
---|---|
Master CI: | |
Downloads: | http://pypi.python.org/pypi/pulsar-cloud |
Source: | https://github.com/quantmind/pulsar-cloud |
Mailing list: | google user group |
Design by: | Quantmind and Luca Sbardella |
Platforms: | Linux, OSX, Windows. Python 3.5 and above |
Keywords: | amazon, aws, botocore, pusher, websocket, async, pulsar, greenlet |
Botocore
这个库提供了botocore的两个异步实现。
模块的某些部分取自aiobotocore-apache LICENSE。
Asyncio Botocore
第一个实现只使用来自python标准库的asyncio,并且 需要一个与异步兼容的http客户端,如pulsar客户端 (默认使用):
fromcloud.awsimportAsyncioBotocores3=AsyncioBotocore('s3','us-east-1')s3=awaits3.put_object(...)
Green Botocore
第二个实现是在asyncio botocore之上构建的,它使用 pulsar和greenlet来获得隐式异步行为。
用法:
fromcloud.awsimportGreenBotocorefrompulsar.apps.greenioimportGreenPooldefexecute():s3=GreenBotocore('s3','us-east-1')ec2.put_object(...)pool=GreenPool()awaitpool.submit(execute)
Pusher
使用 pulsar异步框架。 创建pusher实例
fromcloudimportPusherpusher=Pusher(app_id,key,secret)
以客户身份订阅频道
channel=awaitpusher.subscribe('test_channel')channel.bind('event',mycallback)