json-post
Tool for posting JSON to an API, broken into pages
Why would you need this?
This tool is for a very specific use-case. Let's say you have 80MB of data that you want to send to an API. The data is a big JSON file with thousands of items in it - but the API you are using can only accept 50 items at a time.
json-post can take that big JSON file and break it up into batches, then send each batch to the API in turn.
json-post my-big-json-file.json https://example.com/my-api --batch-size 50
Installation
Install this tool using pip:
$ pip install json-post
Options
-h or --header KEY VALUE
Takes two arguments to specify an HTTP header, for example to send an authorization token you might use:
json-post d.json https://example.com/api --header Authorization "Bearer x...."
--log FILENAME
A filename to log the JSON responses from the API to, as newline-delimited JSON.
--batch-size N
The batch size to use. Omit this and the data will be sent in a single request.
--stop-after N
Send this many items and then stop. Useful for debugging.
--reverse
Send the items from the file in reverse order.
--shuffle
Send the items from the file in random order.
--http-read-timeout N
Timeout (in seconds) for network read operations.
--filter 'item.get("field")'
Filter the items in the array using this Python expression before sending them. The variable item will refer to each item in the list.
--count
Output the number of items that would be sent and then exit. Useful for testing that your --filter operation works as expected.
Development
To contribute to this tool, first checkout the code. Then create a new virtual environment:
cd json-post
python -mvenv venv
source venv/bin/activate
Or if you are using pipenv:
pipenv shell
Now install the dependencies and tests:
pip install -e '.[test]'
To run the tests:
pytest
Metadata
Release files for json-post 0.2
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 |
|---|---|---|---|---|
| json-post-0.2.tar.gz | 3.9 kB | Without provenance | Details for json-post-0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| json_post-0.2-py3-none-any.whl | Python 3 | none | any | Details for json_post-0.2-py3-none-any.whl |
Total release size: 12.0 kB
Release files / json-post-0.2.tar.gz
| Download URL | json-post-0.2.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a47cb4455b9274cc02d9bcd289cd8149da8b1a108f77b1d259ce79e02bcb0ef1
|
|
BLAKE2b-256 checksum How to use checksums |
80cd77f210f98ebd5d697f7c30bad515aff36040f9d37a2fc47e8dfc77ec0975
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
|
Release files / json_post-0.2-py3-none-any.whl
| Download URL | json_post-0.2-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eaacf96bc290972c05b97e807253c1dfbf286b4e5bae0a7b54c98d248b2f066b
|
|
BLAKE2b-256 checksum How to use checksums |
0f9f250ee2501d8a2199d5b0e360022d225d268a2cdda5e7350ae65067db971a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
|
Security for json-post 0.2
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.