通过pip
$ pip install qiniu
Qiniu SDK版本 | Python 版本 |
---|---|
7.x | 2.7, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 |
6.x | 2.7 |
import qiniu
...
q = qiniu.Auth(access_key, secret_key)
key = 'hello'
data = 'hello qiniu!'
token = q.upload_token(bucket_name)
ret, info = qiniu.put_data(token, key, data)
if ret is not None:
print('All is OK')
else:
print(info) # error message in info
...
更多参见SDK使用指南: https://developer.qiniu.com/kodo/sdk/python
## 测试
``` bash
$ py.test
ImportError: No module named requests.auth
请安装 requests
。详情参考代码提交指南。
The MIT License (MIT).详情见 License文件.