Skip to content

Commit

Permalink
add usage
Browse files Browse the repository at this point in the history
  • Loading branch information
chenwenquan committed Aug 2, 2016
1 parent c1b9ccc commit d160ae4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
```
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
.. code:: bash
pip install flask-qiniu
pip install qiniufs
Links
`````
* `website <https://github.com/kevinchendev/flask-qiniu>`_
* `website <https://github.com/kevinchendev/qiniufs>`_
"""

Expand Down

0 comments on commit d160ae4

Please sign in to comment.