botocore-tornado-0.93.1
توضیحات
botocore subclasses that uses AsyncHTTPClient
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | botocore-tornado-0.93.1 |
| نام | botocore-tornado |
| نسخه کتابخانه | 0.93.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Simon Hewitt |
| ایمیل نویسنده | simon@qudos.com.com |
| آدرس صفحه اصلی | https://github.com/qudos-com/botocore-tornado |
| آدرس اینترنتی | https://pypi.org/project/botocore-tornado/ |
| مجوز | The MIT License (MIT) Copyright (c) 2015 Simon Hewitt Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
botocore-tornado
================
This module provides subclasses of `botocore <https://github.com/boto/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
------------
.. code-block:: bash
pip install botocore-tornado
Example
-------
Uploading a file to S3:
.. code-block:: python
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:
.. code-block:: python
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)
نحوه نصب
نصب پکیج whl botocore-tornado-0.93.1:
pip install botocore-tornado-0.93.1.whl
نصب پکیج tar.gz botocore-tornado-0.93.1:
pip install botocore-tornado-0.93.1.tar.gz