Make http requests based on a CSV input file
Project description
csv2http
CLI tool and library for making a series of JSON or form-encoded HTTP requests based on a CSV file input.
Quick start
Install
pip install csv2http
Or with pipx (recommended)
pipx install csv2http
Check CLI usage
❯ csv2http --help
usage: csv2http [-h] [-c CONCURRENCY] [--method {POST,PATCH,PUT}] [-d] [-n] file url
HTTP request for every row of a CSV file - v0.0.2a
positional arguments:
file payload csv file
url URL destination - called with `http` if scheme is absent
options:
-h, --help show this help message and exit
-c CONCURRENCY, --concurrency CONCURRENCY
Maximum number of concurrent requests (default: 25)
--method {POST,PATCH,PUT}
HTTP method/verb (default: POST)
-d, --form-data Send payload as form encoded data instead of JSON (default: false)
-n, --no-save Do not save results to log file (default: false)
Mockbin Example
Make POST calls to http://mockbin.org from a local csv file.
First setup a new bin
, using httpie, curl or the web ui and get a bin id.
❯ http POST mockbin.com/bin/create status:=201 statusText=Created httpVersion=HTTP/1.1 headers:='[]' cookies:='[]' 'content[mimeType]'=application/json --body
"9e95289e-d048-4515-9a61-07f2c74810f5"
Create your my_file.csv
and pass it to csv2http
.
Use the returned bin id from before.
❯ csv2http my_file.csv mockbin.org/bin/9e95289e-d048-4515-9a61-07f2c74810f5 --concurrency 3
POST http://mockbin.org/bin/mockbin.org/bin/9e95289e-d048-4515-9a61-07f2c74810f5
status codes - {200: 3}
status codes - {200: 3}
status codes - {200: 3}
status codes - {200: 1}
Check the bin log from. https://mockbin.org/bin/9e95289e-d048-4515-9a61-07f2c74810f5/log
Roadmap
- As Library - Alpha
- parse csv as dictionary/json - Alpha
- accept mutator function - Alpha
- HTTP POST request with json from csv - Alpha
- limit concurrency - Alpha
- non-blocking file IO - ???
- hooks for response results - Beta
- mkdoc docs - Beta
- As CLI - Beta
- argparse - Alpha
- write results to logfile - Beta
- progress bar - ???
- use dedicated CLI library with pretty colors (typer, rich etc.) - Beta
- Nested fields - V1
- Complete Docs - V1
-
create_mockbin.csv
andexample.csv
to use in quickstart - Beta - examples for using as library
-
- GH Actions CI (lint, test, etc.)
- GH Actions CD (publish to pypi)
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
csv2http-0.0.2a1.tar.gz
(15.5 kB
view details)
Built Distribution
File details
Details for the file csv2http-0.0.2a1.tar.gz
.
File metadata
- Download URL: csv2http-0.0.2a1.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.4 Darwin/21.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ee3fb8439b9b66fd5bae09616646c026629856fa3539fe4cbfcdaaca03594c9 |
|
MD5 | d7442054c5cfeb2277fd8d92bdce17f9 |
|
BLAKE2b-256 | 0cf293f12bce0896085363d531ca235a2b0a9daa5a03915e8d710c6898d7c54d |
File details
Details for the file csv2http-0.0.2a1-py3-none-any.whl
.
File metadata
- Download URL: csv2http-0.0.2a1-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.4 Darwin/21.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 948db407f9961bc9e18b07df1ede760ac453d5d8ae7a52b065aab4ddb211974c |
|
MD5 | c0b8624871d1b866cd244e076a624daf |
|
BLAKE2b-256 | 8a1c5f3a84a1fce8c37a4dd2ccf33b7c62716f1f257b9dd5785ea32c68011d7f |