Facebook-like implementation of batch requests
Project description
Quick start
examples:
curl -X POST \ http://127.0.0.1:8000/batch/ \ -H 'cache-control: no-cache' \ -H 'content-type: application/json' \ -d '{"batch": [ { "method": "get", "relative_url": "/test/", "name": "yolo" }, { "method": "post", "relative_url": "/test/?id={result=yolo:$.id}&ids={result=yolo:$.data.*.id}", "body": {"data": {"id": "{result=yolo:$.id}", "ids": "{result=yolo:$.data.*.id}"}, "test": "yolo"} }, { "method": "post", "relative_url": "/test/", "body": "{\"data\": 42}", "omit_response_on_success": true }, { "method": "options", "relative_url": "/test/" } ] }'
using file uploading
curl -X POST \ http://127.0.0.1:8000/batch/ \ -H 'cache-control: no-cache' \ -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \ -F 'batch=[ { "method": "get", "relative_url": "/test/", "name": "yolo" }, { "method": "post", "relative_url": "/test/?id={result=yolo:$.id}&ids={result=yolo:$.data.*.id}", "body": {"data": "{result=yolo:$.data.*.id}", "test": "yolo"}, "attached_files":{"file": "a.jpg"} }, { "method": "post", "relative_url": "/test/", "body": "{\"data\": 42}", "omit_response_on_success": true, "attached_files":["a.jpg", "b.png"] }, { "method": "options", "relative_url": "/test/" } ]' \ -F b.png=@2476.png \ -F a.jpg=@check_133.pdf
Future features:
add support for requests pipelining. use responses as arguments to next requests (done)
build graph based on requests dependencies & run simultaneously independent.
[STRIKEOUT:switchable atomic support. true - all fails if something wrong. else - fail only dependent (can be very hard to support on front-end side, but for now seems as good feature)] run all requests in single transaction. (done)
[STRIKEOUT:use native django. we don’t use complicated things that require drf for work. all can be done with “naked” django.] (since we validate requests with drf serializers, it’s better to leave as it is).
support files uploading (done)
Dependencies:
Django starting from 2.2
Django rest framework
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file drf-batch-requests-0.9.4.tar.gz
.
File metadata
- Download URL: drf-batch-requests-0.9.4.tar.gz
- Upload date:
- Size: 32.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38847ced3157840cb16c49c2ef9a32355e846c8268878b8e78da01ccbd28e1f1 |
|
MD5 | 30036520e8744e5e7cb8fe8eda8f06dc |
|
BLAKE2b-256 | b8392aeba409b5bcee6cec1d57d479269644dc6422a07f80f8bc8920d536743d |
File details
Details for the file drf_batch_requests-0.9.4-py3-none-any.whl
.
File metadata
- Download URL: drf_batch_requests-0.9.4-py3-none-any.whl
- Upload date:
- Size: 76.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d05c2901edf137e4fa5842b4f2a03bd5f437a4a1165962a7c14e511d770b7e3 |
|
MD5 | d29741aa21ea9989023cbb5151e4a6a7 |
|
BLAKE2b-256 | 71798d8bbd8f89fc9d23dbad7f8d94c96c6b270e1cc0042da05c6894d0eaa911 |