From d160ae4a6c227d5eaae9b8d0b0aeac7936da751b Mon Sep 17 00:00:00 2001 From: chenwenquan Date: Wed, 3 Aug 2016 03:39:47 +0800 Subject: [PATCH] add usage --- README.md | 29 +++++++++++++++++++++++++++-- setup.py | 4 ++-- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d319dd9..c371262 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,27 @@ -# flask-qiniu -Qiniu file system for Flask +QINIUFS +======= + +Qiniu file uploader for Flask + + +## Install +``` +$ pip install qiniufs +``` + +## Usage +```python +bucket = "your-qiniu-bucket-name" +prefix_urls = "your-qiniu-url" +fs = QiniuFS(bucket, access_key, secret_key, prefix_urls) + +def upload_picture(picture): + mime = picture.mimetype + data = picture.read() + if data: + r, d = fs.upload(data, mime) + if r and d: + key = d.get('key') + url = fs.get_url(d.get('key')) + return key, url +``` diff --git a/setup.py b/setup.py index 7574af7..99d2624 100644 --- a/setup.py +++ b/setup.py @@ -4,12 +4,12 @@ .. code:: bash - pip install flask-qiniu + pip install qiniufs Links ````` -* `website `_ +* `website `_ """