fdfs-tornado-0.1a1
توضیحات
Async FDFS Client for tornado
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | fdfs-tornado-0.1a1 |
| نام | fdfs-tornado |
| نسخه کتابخانه | 0.1a1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | WangST |
| ایمیل نویسنده | wangst321@gmail.com |
| آدرس صفحه اصلی | http://git.elenet.me/opdev/eoc-api.git |
| آدرس اینترنتی | https://pypi.org/project/fdfs-tornado/ |
| مجوز | UNKNOWN |
===============================
Async FDFS Client for tornado
===============================
This library provides an async FDFS client for tornado.
QuickStart
===========
install using pip::
$ pip install fdfs-tornado
Basic Usage
============
init a client
--------------
use ``tracker_ip`` and ``tracker_port`` to initialize the FDFS Client.
Create a single client for a specific case.
.. code-block:: python
from fdfs_tornado.client import makeclient
AsyncFDFSClient = makeclient(tracker_ip, tracker_port)
client = AsyncFDFSClient()
.. note::
the client will not create any connection before upload or download
actions.
upload a file
--------------
To upload a file. First open the file in binary mode, and get the size, those
are required.
.. code-block:: python
from tornado.ioloop import IOLoop
ioloop = IOLoop.instance()
client = AsyncFDFSClient()
with open(filename, 'rb') as f:
file_size = os.stat(filename).st_size
future = client.upload(f, file_size)
future.add_done_callback(lambda _: ioloop.close())
ioloop.start()
ret = future.result()
نحوه نصب
نصب پکیج whl fdfs-tornado-0.1a1:
pip install fdfs-tornado-0.1a1.whl
نصب پکیج tar.gz fdfs-tornado-0.1a1:
pip install fdfs-tornado-0.1a1.tar.gz