Dead simple, self-contained, single-file API load testing tool built on FastAPI.
Find a file
Sergey Silaev f6b9932c77
Some checks failed
Lint and Pre-commit Check / lint-and-pre-commit (push) Has been cancelled
Update README.md
2025-03-11 12:40:10 +01:00
.github/workflows Update deps, some fixes 2025-03-08 16:21:01 +01:00
images v.0.2.1 2024-11-03 03:03:28 +01:00
tests Update deps, some fixes 2025-03-08 16:21:01 +01:00
.gitignore Update deps, some fixes 2025-03-08 16:21:01 +01:00
.pre-commit-config.yaml Update deps, some fixes 2025-03-08 16:21:01 +01:00
.python-version v.0.2.1 2024-11-03 03:03:28 +01:00
LICENSE Initial commit 2024-11-02 23:17:31 +01:00
Makefile Update deps, some fixes 2025-03-08 16:21:01 +01:00
pyproject.toml Update deps, some fixes 2025-03-08 16:21:01 +01:00
README.md Update README.md 2025-03-11 12:40:10 +01:00
ruff.toml Update deps, some fixes 2025-03-08 16:21:01 +01:00
scapi.py Update deps, some fixes 2025-03-08 16:21:01 +01:00
uv.lock Update deps, some fixes 2025-03-08 16:21:01 +01:00

scapi

Dead simple, Self-Contained, single-file API load testing tool built on FastAPI.


Source Code: https://8am.dev/enodllew/scapi

Sometimes, I need a simple tool to make a few requests to external APIs, create a bit of load, experiment with headers, check the average response time, and so on. I want to be able to launch this tool from any environment with one click without having to figure anything out.

The existing tools seemed inconvenient to me, so I created a tiny tool that generates load and can be launched with just one command. Thanks to the inline metadata format and the uv package and project manager, there's no need to manually set up environments.

You just need Python installed on the target machine, and that's it. No more worrying about virtual environments. One file, one command, and you get your beautiful FastAPI Swagger UI ready to work.

Installation

Live demo

asciicast

curl -LOs https://8am.dev/enodllew/scapi/releases/download/latest/scapi.py

or

wget https://8am.dev/enodllew/scapi/releases/download/latest/scapi.py

Install the uv using the official script or via pip install, and then simply run:

uv run scapi.py

Done!

If you want to run scapi.py in a container, just run:

docker run -ti --rm -p "8000:8000" python:3.12-slim-bookworm bash

And repeat the same steps, but this time in a container.

Requirements

  • wget or curl;
  • Python version 3.12* or higher;
  • Install the uv;

* It may work on other versions, but I haven't tested them as I don't see much point in doing so.

How to use it

When the application starts, you will see two endpoints: /load and /results.

It's incredibly simple to use — you just specify the domain, request method, delay between requests, number of attempts, headers and body (if needed), and whether you want to see the response body and response headers (see the screenshots below).

You can also click "Execute" multiple times to generate more tasks for event loop.

load

At the end of or during the execution, you can also execute the /results endpoint to see the total number of requests sent, broken down by status, along with the average response time for requests to the specified URL.

load

You should know

It is important to understand this is a very simple, single-threaded application. Its purpose is to conduct small, quick tests by generating a relatively small number of requests, with the ability to run in almost any environment where Python is available and the uv binary can be copied.

If you need to perform serious load testing, this application will not be suitable, and you should consider more robust tools such as Locust, Apache JMeter, and others.

License

This repository is licensed under the MIT License