CouchDB Download Token Service
Simple web service that allows downloading CouchDB document attachments with a per-document download token.
This project was created with the objetive of provide GET URLs for CouchDB document attachments without having specify the couch username and password in the URL itself or in the request headers.
The method I found to do this worrying about permissions is assigning each document a secret download_token field to each document that will have to match when doing requests to this service.
The service needs to have admin user credentials so it can query all document’s attachments and decide which clients give then. To do this you have to set a COUCHDB_URL environment variable of format http://admin_user:password@server_domain:5984. By default it uses localhost with no user credentials.
Free software: GNU General Public License v3
Documentation: https://couchdb-download-token.readthedocs.io.
Example usage
$ 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
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2016-07-11)
First release on PyPI.
Metadata
Release files for couchdb_download_token 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| couchdb_download_token-0.1.1.tar.gz | 25.7 kB | Without provenance | Details for couchdb_download_token-0.1.1.tar.gz |
Release files / couchdb_download_token-0.1.1.tar.gz
| Download URL | couchdb_download_token-0.1.1.tar.gz |
|---|---|
| Size | 25.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45003e48f7a40aa81007c933c5be68401e677933711d2bec40a8b31f22b51e06
|
|
BLAKE2b-256 checksum How to use checksums |
7223b98a9d31af0f93e5b63cdbf38eeb4f7dae5d1c73eeb570528432d2ab09f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for couchdb_download_token 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.