Skip to main content

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 botocore_tornado.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

botocore-tornado-0.93.1.tar.gz (5.8 kB view details)

Uploaded Source

File details

Details for the file botocore-tornado-0.93.1.tar.gz.

File metadata

File hashes

Hashes for botocore-tornado-0.93.1.tar.gz
Algorithm Hash digest
SHA256 9b42db43636c36016608786c721b0a41d241426290f3bd9a5bacf9759ab226e3
MD5 f919966df58e35c35d662b3cb7c73b21
BLAKE2b-256 522e3b2659bcc77d04a9892e7621f543a52721fc3d1f604cc133e0b3a1e85473

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