Skip to main content

API Stress Lab

Run configurable HTTP load tests from your terminal and get latency percentiles, throughput, failure breakdowns, and shareable JSON/HTML reports.

Python 3.11+ | MIT license | Early-stage, single-machine CLI

Install

From a checkout:

git clone https://github.com/saurabh-1008/api-stress-lab.git
cd api-stress-lab
python -m venv .venv
# Windows PowerShell: .venv\Scripts\Activate.ps1
# macOS/Linux: source .venv/bin/activate
python -m pip install -e .

After the first PyPI release, users can install with python -m pip install api-stress-lab.

Try It Locally

Start the included demo API in one terminal:

python examples/demo_api.py

In another terminal with the same virtual environment active:

api-stress-lab run examples/simple-get.yaml
api-stress-lab run examples/post-json.yaml

You can also use python -m api_stress_lab run examples/simple-get.yaml. The demo requires only Python's standard library.

Test Your API

Create my-api.local.yaml:

target:
  url: "http://127.0.0.1:8000/health"
  method: GET
load:
  total_requests: 1000
  concurrency: 20
  timeout_seconds: 10
  ramp_up_seconds: 2
assertions:
  expected_status: [200]
  max_p95_ms: 500
  max_error_rate_percent: 0

Change the URL to your own endpoint, then run:

api-stress-lab run my-api.local.yaml

Run tests only against systems you own or have permission to test.

Configuration

Field Default Meaning
target.url Required Absolute HTTP or HTTPS endpoint
target.method GET GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
target.headers {} Request headers, including static auth tokens
target.query {} Query parameters
target.body None Object/list sent as JSON; other values as raw text; disallowed for GET/HEAD
load.total_requests 100 Positive number of requests across all workers
load.concurrency 10 Positive maximum worker count
load.timeout_seconds 30 Positive HTTPX timeout for each network phase, not a whole-test deadline
load.ramp_up_seconds 0 Nonnegative period over which workers start
assertions.expected_status [200] Nonempty list of successful status codes; every request must match
assertions.max_p95_ms Disabled Maximum inclusive p95 latency
assertions.max_error_rate_percent Disabled Maximum inclusive error percentage
assertions.min_rps Disabled Minimum inclusive observed requests/second
report.output_dir reports Output directory relative to the current working directory
report.name Timestamp Run subfolder; a fixed name overwrites that run's report files

Headers and config values are literal; environment-variable expansion is not implemented. Keep tokens in ignored *.local.yaml files.

Reports And Exit Codes

Open reports/<run-name>/index.html in a browser, or read report.json for automation. Reports include request totals, status codes, timeout and connection error counts, bytes received, observed RPS, min/average/max latency, p50/p90/p95/p99, and assertion results. Request headers, query parameters, bodies, URL credentials, and URL query strings are omitted from reports. Review endpoint paths before sharing.

Exit codes: 0 means all assertions passed; 1 means an assertion failed; 2 means configuration or execution failed. The expected-status assertion is strict: any failed request makes the run fail, even if an error-rate threshold would otherwise allow it.

Current Limits

This version tests one endpoint per run using a fixed request count and async workers. It does not provide a fixed arrival-rate scheduler, distributed workers, duration-based runs, scenario chaining, automatic login, or server-side diagnostics. Responses are not retried and redirects are not followed. Results are retained in memory for percentile calculation, so memory grows with request count. Throughput depends on the generator machine and network as well as the target API.

Guides

The maintained CLI lives in api_stress_lab/.

Metadata

Release files for api-stress-lab 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for api-stress-lab 0.1.0
File Size Uploaded Provenance Actions
api_stress_lab-0.1.0.tar.gz 21.4 kB Without provenance Details for api_stress_lab-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for api-stress-lab 0.1.0
File Interpreter ABI Platform Actions
api_stress_lab-0.1.0-py3-none-any.whl Python 3 none any Details for api_stress_lab-0.1.0-py3-none-any.whl

Total release size: 34.1 kB

Release files / api_stress_lab-0.1.0.tar.gz

Download URL api_stress_lab-0.1.0.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e3982fcccf612b5841eb69375496af4eebc7a87a28ebdd8981d9f6c7dbf34e01
BLAKE2b-256 checksum
How to use checksums
be294eb87f921e0f00fa34412367ead3184a8efadb0e2e393121371b97b65baa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / api_stress_lab-0.1.0-py3-none-any.whl

Download URL api_stress_lab-0.1.0-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35a60fd30dbad1af1014c5384e923f9602702cfd1f919b9c3abf3ad3a67e13cd
BLAKE2b-256 checksum
How to use checksums
7b14075bdadb328a8285927e961c97d4887d31714999b6f7334951336c61a2e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Security for api-stress-lab 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.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page