## 安装
通过pip
```bash
$ pip install qiniu-async
```
## 使用方法
### 上传
```python
import asyncio
import qiniu_async
q = qiniu_async.Qiniu(access_key,access_secret)
token = q.upload_token(bucketname)
# 文件流上传
asyncio.run(q.upload_data(token,"333.txt","123测试"))
# 文件地址上传
asyncio.run(q.upload_file(token,"mypic0.jpeg","/Users/liuyue/Downloads/mypic0.jpeg"))
### 异步框架接入
#### Tornado
```python
import qiniu_async
async def post(self):
file = self.request.files['file']
for meta in file:
filename = meta['filename']
q = qiniu_async.Qiniu(access_key,access_secret)
token = q.upload_token(bucketname)
await q.upload_data(token,filename,meta['body'])
return self.write('Your file has been uploaded')
```
Raw data
{
"_id": null,
"home_page": "https://github.com/qiniu-async",
"name": "qiniu-async",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "qiniu,qiniu_async,async",
"author": "LiuYue",
"author_email": "zcxey2911@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/03/ff/7db8f616a6271960ef37bb43a9efe57a30275442e6dce370b2438918af66/qiniu-async-1.0.1.tar.gz",
"platform": null,
"description": "## \u5b89\u88c5\n\n\u901a\u8fc7pip\n\n```bash\n$ pip install qiniu-async\n```\n\n## \u4f7f\u7528\u65b9\u6cd5\n\n### \u4e0a\u4f20\n```python\nimport asyncio\nimport qiniu_async\n\n\nq = qiniu_async.Qiniu(access_key,access_secret)\n\ntoken = q.upload_token(bucketname)\n\n# \u6587\u4ef6\u6d41\u4e0a\u4f20\nasyncio.run(q.upload_data(token,\"333.txt\",\"123\u6d4b\u8bd5\"))\n\n# \u6587\u4ef6\u5730\u5740\u4e0a\u4f20\nasyncio.run(q.upload_file(token,\"mypic0.jpeg\",\"/Users/liuyue/Downloads/mypic0.jpeg\"))\n\n\n### \u5f02\u6b65\u6846\u67b6\u63a5\u5165\n\n#### Tornado\n\n```python\nimport qiniu_async\n\nasync def post(self):\n\n file = self.request.files['file']\n\n for meta in file:\n filename = meta['filename']\n\n q = qiniu_async.Qiniu(access_key,access_secret)\n\n token = q.upload_token(bucketname)\n\n await q.upload_data(token,filename,meta['body'])\n \n\n return self.write('Your file has been uploaded')\n\n```\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "qiniu_async python library",
"version": "1.0.1",
"split_keywords": [
"qiniu",
"qiniu_async",
"async"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "539f2b5d2e376cd66997bb0ee0a39c67",
"sha256": "c599da1c02a3db21d5e45066540400cd943e449ff0f7253039d53eb25a914301"
},
"downloads": -1,
"filename": "qiniu-async-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "539f2b5d2e376cd66997bb0ee0a39c67",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3193,
"upload_time": "2022-12-29T09:01:25",
"upload_time_iso_8601": "2022-12-29T09:01:25.981755Z",
"url": "https://files.pythonhosted.org/packages/03/ff/7db8f616a6271960ef37bb43a9efe57a30275442e6dce370b2438918af66/qiniu-async-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-29 09:01:25",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "qiniu-async"
}