kamsekam
Finds the smallest version of an HTTP request that still produces the same response. Takes a request, replays it while removing parts, and prints what is left.
Install
uv tool install kamsekam # the kamsekam command
uv tool install 'kamsekam[impersonate]' # adds browser impersonation using curl_cffi
Usage
Everything after -- is parsed as a curl command:
$ kamsekam -- curl 'https://data.services.jetbrains.com/products?code=TC&release.type=eap%2Crc%2Crelease&fields=distributions%2Clink%2Cname%2Creleases&_=1789067502753' \
--compressed \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:155.0) Gecko/20100101 Firefox/155.0' \
-H 'Accept: */*' \
-H 'Accept-Language: en' \
-H 'Accept-Encoding: gzip, deflate, br, zstd' \
-H 'Origin: https://www.jetbrains.com' \
-H 'DNT: 1' \
-H 'Sec-GPC: 1' \
-H 'Connection: keep-alive' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: same-site' \
-H 'Priority: u=4' \
-H 'TE: trailers'
input GET https://data.services.jetbrains.com/products · 20 atoms · 503 bytes
baseline 200 application/json 176949B sha256:67308c6c7677
minimised 21 requests · 20 atoms → 2 · 388 bytes saved
keep query:code ?code=TC
keep query:fields ?fields=distributions%2Clink%2Cname%2Creleases
drop 18 removed: header:user-agent, header:accept, header:accept-language, header:accept-encoding[0], header:accept-encoding[1], header:accept-encoding[2], header:accept-encoding[3], header:origin, header:dnt, header:sec-gpc, header:connection, header:sec-fetch-dest, header:sec-fetch-mode, header:sec-fetch-site, header:priority, header:te, query:release.type, query:_
curl 'https://data.services.jetbrains.com/products?code=TC&fields=distributions%2Clink%2Cname%2Creleases'
How it works
- The request is sent once and the response recorded as a signature
(status, content-type, body size, body sha256). - It is split into atoms: each header, each element of a comma-separated
header (
Accept: a, b, cgives three), each cookie, each query parameter, and each form field or top-level JSON key. - Delta debugging removes subsets of atoms and replays, keeping any removal that leaves the signature unchanged, then renders what survived.
The algorithm is ddmin (Zeller & Hildebrandt) 1. It sends the request hundreds of times, so use it only on idempotent requests.
HAR archives
With a HAR file and no --format override, every GET entry is minimised in
place, the rest of the archive copied unchanged.
kamsekam -o minimal.har session.har
kamsekam session.har # writes session-minimal.har, then -1, -2, ...
Options
| Option | |
|---|---|
-f, --format |
curl, har, httpie, http, json; comma-separated |
-o, --output |
write to a file instead of stdout |
--impersonate ID |
replay via curl_cffi with a browser TLS fingerprint |
--match |
signature fields that must hold: status,type,hash (default), or size when a body embeds a token or timestamp and its sha256 never repeats |
--baseline-runs N |
baseline replays used to detect unstable responses (default 2) |
--keep PATTERN |
never remove matching atoms, e.g. --keep 'header:authorization' |
--dry-run |
list atoms and exit without sending anything |
An unstable baseline is detected and --match relaxed automatically. Run
kamsekam --help for the rest.
Library
Minimized requests are returned as httpx2.Request objects, but are also available
as curl strings.
import httpx2
from kamsekam import minimise, to_curl, uncurl
uncurl("curl https://e.test -H 'a: b' --compressed") # -> httpx2.Request; to_curl() reverses it
result = minimise(httpx2.Request("GET", url, headers={"x-a": "1"}), impersonate="chrome131")
result.as_httpx2() # httpx2.Request, minimised
result.to_curl() # command string; also result.kept / .removed / .stats
License
Licensed under Unlicense
-
https://doi.org/10.1109/32.988498 "Simplifying and Isolating Failure-Inducing Input", IEEE Transactions on Software Engineering" ↩
Metadata
Release files for kamsekam 0.1.0
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 |
|---|---|---|---|---|
| kamsekam-0.1.0.tar.gz | 26.7 kB | With provenance | Details for kamsekam-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kamsekam-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for kamsekam-0.1.0-py3-none-any.whl |
Total release size: 62.1 kB
Release files / kamsekam-0.1.0.tar.gz
| Download URL | kamsekam-0.1.0.tar.gz |
|---|---|
| Size | 26.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7e583e3b900ce9b8d3e1b96925310f5479093df74d3bbb45816b2fee6456d03
|
|
BLAKE2b-256 checksum How to use checksums |
2ad3ac96ae10c4334f2fded26ba350c55f61598813e7a7f8ea2f188f7e477631
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logRelease files / kamsekam-0.1.0-py3-none-any.whl
| Download URL | kamsekam-0.1.0-py3-none-any.whl |
|---|---|
| Size | 35.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
15e5210d8808d7cad386b4cc4242913338ce8d765228e8f0e8c9c72feada9749
|
|
BLAKE2b-256 checksum How to use checksums |
adc6f58ebe2c5f1c8cb501705dfe7a6d55cc3170c0cf7e9df00b621506723083
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logSecurity for kamsekam 0.1.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for kamsekam-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logA 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.