Skip to main content

Async FDFS Client for tornado

Project description

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.

from fdfs_tornado.client import makeclient

AsyncFDFSClient = makeclient(tracker_ip, tracker_port)
client = AsyncFDFSClient()

upload a file

To upload a file. First open the file in binary mode, and get the size, those are required.

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()

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

fdfs-tornado-0.1a1.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file fdfs-tornado-0.1a1.tar.gz.

File metadata

  • Download URL: fdfs-tornado-0.1a1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fdfs-tornado-0.1a1.tar.gz
Algorithm Hash digest
SHA256 f09ac84f5914198cb1757eccafbd262887b0f66aa1123ed8539665abc056ddb6
MD5 13783dfd8f265293f4cfa833ec0c3c3f
BLAKE2b-256 0497147621385aa2850de4ba92dc3b51d43f416ee8dc8adb3ba949ecb69c08ec

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