简单的web服务,允许使用每个文档下载令牌下载couchdb文档附件。
couchdb_download_token的Python项目详细描述
couchdb下载令牌服务
简单的web服务,允许使用每个文档下载令牌下载couchdb文档附件。
这个项目的目标是为couchdb文档提供get url 没有在url中指定couch用户名和密码的附件 或者在请求头中
我发现的担心权限的方法是为每个文档分配一个 将secret下载令牌字段添加到执行此操作时必须匹配的每个文档 请求此服务。
该服务需要具有管理员用户凭据,以便可以查询所有文档的 附件,然后决定哪些客户提供。为此,您必须设置 格式的环境变量 http://admin_user:password@server_domain:5984默认情况下,它使用本地主机 没有用户凭据
- 自由软件:GNU通用公共许可v3
- 文档:https://couchdb-download-token.readthedocs.io
示例用法
$ pip3 install couchdb_download_token $ pip3 install gunicorn $ gunicorn couchdb_download_token:api [2016-07-12 23:33:28 -0300] [7880] [INFO] Starting gunicorn 19.6.0 [2016-07-12 23:33:28 -0300] [7880] [INFO] Listening at: http://127.0.0.1:8000 (7880) [2016-07-12 23:33:28 -0300] [7880] [INFO] Using worker: sync [2016-07-12 23:33:28 -0300] [7884] [INFO] Booting worker with pid: 7884 $ curl http://localhost:5984/my_database/my_document { "_id": "my_document", "_rev": "4-763e041701ae3e55fd4af08dff93efc4", "info": "test document", "download_token": "123456", "_attachments": { "file.txt": { "content_type": "text/plain", "revpos": 2, "digest": "md5-U0f+Rrm7WPnsUGK3oD8t8g==", "length": 100, "stub": true } } } $ curl http://localhost:8000/my_database/my_document/file.txt?token=incorrect ... < HTTP/1.1 403 Forbidden < Server: gunicorn/19.6.0 ... $ curl http://localhost:8000/my_database/my_document/file.txt?token=123456 ... < HTTP/1.1 200 OK < Server: gunicorn/19.6.0 < Date: Wed, 13 Jul 2016 03:02:07 GMT < Connection: close < Transfer-Encoding: chunked < content-type: text/plain File contents
学分
这个包是用Cookiecutter和audreyr/cookiecutter-pypackage项目模板创建的。
历史
0.1.0(2016-07-11)
- pypi上的第一个版本。