botocore subclasses that uses AsyncHTTPClient
Project description
This module provides subclasses of botocore classes that use the tornado AsyncHTTPClient to make requests. As far as possible, the api is kept the same as the botocore api, the only difference is that Operation.call returns a Future that is resolved when the http request is complete.
Installation
pip install botocore-tornado
Example
Uploading a file to S3:
import botocore.session
session = botocore.session.get_session()
s3 = session.get_service('s3')
endpoint = s3.get_endpoint(region)
fp = open('./testfile.txt', 'rb')
operation = s3.get_operation('PutObject')
http_response, response_data = operation.call(endpoint,
bucket=bucket,
key=key + '/' + filename,
body=fp)
Using botocore-tornado:
from tornado.ioloop import IOLoop
from tornado import gen
import tornado_botocore.session
@gen.coroutine
def main_async():
session = botocore_tornado.session.get_session()
s3 = session.get_service('s3')
endpoint = s3.get_endpoint(region)
fp = open('./testfile.txt', 'rb')
operation = s3.get_operation('PutObject')
http_response, response_data = yield operation.call(endpoint,
bucket=bucket,
key=key + '/' + filename,
body=fp)
print response_data
IOLoop.instance().run_sync(main_async)
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
Close
Hashes for botocore-tornado-0.85.0.a.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e96c892ee781eb0677f3bcd498c34cfdb24ef1acf337b776a87d6ecb27adf227 |
|
MD5 | 31bf20a8bbdb5e5a24b2729cd93b878f |
|
BLAKE2b-256 | 084445f1e8f807e76a7b5baa40e11c68c730ace09e1a937b7bbdf51fc5dd1d56 |