简单的web服务,允许使用每个文档下载令牌下载couchdb文档附件。

couchdb_download_token的Python项目详细描述


couchdb下载令牌服务

https://img.shields.io/pypi/v/couchdb_download_token.svghttps://img.shields.io/travis/sh4r3m4n/couchdb_download_token.svgDocumentation StatusCode coverageCode coverage

简单的web服务,允许使用每个文档下载令牌下载couchdb文档附件。

这个项目的目标是为couchdb文档提供get url 没有在url中指定couch用户名和密码的附件 或者在请求头中

我发现的担心权限的方法是为每个文档分配一个 将secret下载令牌字段添加到执行此操作时必须匹配的每个文档 请求此服务。

该服务需要具有管理员用户凭据,以便可以查询所有文档的 附件,然后决定哪些客户提供。为此,您必须设置 格式的环境变量 http://admin_user:password@server_domain:5984默认情况下,它使用本地主机 没有用户凭据

示例用法

$ 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

学分

这个包是用Cookiecutteraudreyr/cookiecutter-pypackage项目模板创建的。

历史

0.1.0(2016-07-11)

  • pypi上的第一个版本。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
来自偏移量的java JavaPairInputStream流   gzip Java TarInputStream读取tar的文件名。包含另一个tar的gz文件。gz文件   如何在Linux shell脚本中确定和使用实际的java路径   java请求太多FirebaseError   java错误json解析   java在localserver上发送安卓应用程序的输出   JavaSpring:启动和停止webapplication时更新DBtable条目   java如何使用JavaFX在矩形处设置文本?   java SQL查询在Hibernate中出现异常   java我无法使用javamail代码通过outlook(hotmail帐户)配置发送邮件,但在gmail中工作正常   java是不同的持久性。测试运行/JPA装置的xml属性   无头Eclipse的java导出战   使用ContentVersionStrategy的java Spring引导缓存禁止使用gzip进行资源压缩   java如何获取计算机的设备令牌?   图像文件的java ImageInfo不包含有效值   继承强制在Java中使用基类方法