A lightweight, blazing-fast, multi-threaded API performance and load testing library for Python. HammerAPI allows you to orchestrate parallel API requests smoothly while automatically collecting cross-platform hardware telemetry (CPU/RAM usage) from your local machine, compiling everything into a self-contained, interactive HTML dashboard.
Project description
A lightweight, blazing-fast, multi-threaded API performance and load testing library for Python.
HammerAPI helps developers, QA engineers, SREs, and performance testers stress-test REST APIs with minimal code while automatically collecting local machine telemetry (CPU/RAM) and generating beautiful interactive HTML reports.
๐ Installation
pip install hammerAPI-tool
โจ Features
๐งต Concurrent API Execution
Run hundreds or thousands of requests using a configurable thread pool.
โฑ๏ธ Multiple Execution Modes
- Run each test case exactly once
- Run continuously for a fixed duration
- Mix multiple endpoints in the same workload
๐ Full HTTP Support
Supports:
- GET
- POST
- PUT
- PATCH
- DELETE
๐ Authentication Support
Works with:
- Bearer Tokens
- API Keys
- Custom Headers
- Session Cookies
๐ Performance Metrics
Automatically captures:
- Response Time
- Success / Failure Counts
- Request Throughput
- Average Latency
- P90 Latency
- P95 Latency
- P99 Latency
๐ฅ๏ธ System Resource Monitoring
Captures local machine:
- CPU Utilization
- RAM Utilization
- Operating System Information
๐ Interactive HTML Dashboard
Generate beautiful standalone reports with:
- Charts
- Percentiles
- Error Analysis
- Resource Consumption Trends
- Request Distribution
๐ Cross Platform
Works on:
- Windows
- Linux
- macOS
๐ Project Structure
hammerAPI/
โโโ LICENSE
โโโ README.md
โโโ pyproject.toml
โโโ logo.png
โโโ logo_readme.png
โโโ src/
โ โโโ hammerapi/
โ โโโ __init__.py
โ โโโ monitor.py
โ โโโ reporter.py
โ โโโ runner.py
โโโ examples/
โโโ sample-code.py
โโโ sample-report.html
โโโ sample-report.jpeg
Quick Start
Simple GET Request
from hammerapi import HammerAPI
hammer = HammerAPI(max_workers=5)
hammer.add_test(
method="GET",
url="https://jsonplaceholder.typicode.com/posts/1"
)
hammer.run()
hammer.generate_report()
Multiple Endpoints
from hammerapi import HammerAPI
hammer = HammerAPI(max_workers=10)
hammer.add_test(
"GET",
"https://jsonplaceholder.typicode.com/posts/1"
)
hammer.add_test(
"GET",
"https://jsonplaceholder.typicode.com/users/1"
)
hammer.add_test(
"GET",
"https://jsonplaceholder.typicode.com/comments/1"
)
hammer.run()
hammer.generate_report()
POST Request with JSON Payload
from hammerapi import HammerAPI
hammer = HammerAPI()
hammer.add_test(
method="POST",
url="https://jsonplaceholder.typicode.com/posts",
json={
"title": "HammerAPI",
"body": "Load Testing",
"userId": 1
}
)
hammer.run()
hammer.generate_report()
Authenticated API Testing
from hammerapi import HammerAPI
hammer = HammerAPI()
hammer.add_test(
method="GET",
url="https://api.example.com/users",
headers={
"Authorization": "Bearer YOUR_TOKEN"
}
)
hammer.run()
API Key Authentication
from hammerapi import HammerAPI
hammer = HammerAPI()
hammer.add_test(
method="GET",
url="https://api.example.com/data",
headers={
"x-api-key": "YOUR_API_KEY"
}
)
hammer.run()
Query Parameters
from hammerapi import HammerAPI
hammer = HammerAPI()
hammer.add_test(
method="GET",
url="https://api.example.com/search",
params={
"page": 1,
"limit": 100
}
)
hammer.run()
Custom Headers
from hammerapi import HammerAPI
hammer = HammerAPI()
hammer.add_test(
method="GET",
url="https://api.example.com/data",
headers={
"Environment": "QA",
"Client": "HammerAPI"
}
)
hammer.run()
PUT Request
hammer.add_test(
method="PUT",
url="https://api.example.com/user/1",
json={
"name": "John Doe"
}
)
PATCH Request
hammer.add_test(
method="PATCH",
url="https://api.example.com/user/1",
json={
"status": "active"
}
)
DELETE Request
hammer.add_test(
method="DELETE",
url="https://api.example.com/user/1"
)
๐ฅ Load Testing For Fixed Duration
Continuously hit endpoints for a specific duration.
from hammerapi import HammerAPI
hammer = HammerAPI(max_workers=25)
hammer.add_test(
"GET",
"https://api.example.com/health"
)
hammer.run(duration_seconds=60)
hammer.generate_report("load_test_report.html")
This will continuously execute requests across 25 worker threads for 60 seconds.
โก High Concurrency Example
from hammerapi import HammerAPI
hammer = HammerAPI(max_workers=100)
hammer.add_test(
"GET",
"https://api.example.com/health"
)
hammer.run(duration_seconds=120)
Perfect for:
- Load Testing
- Stress Testing
- Smoke Testing
- Capacity Planning
๐ Generate Report
hammer.generate_report(
output_path="hammer_report.html"
)
Generated report includes:
- Total Requests
- Success Rate
- Failure Rate
- Average Response Time
- P90 Latency
- P95 Latency
- P99 Latency
- CPU Utilization
- RAM Utilization
- Throughput Analysis
Report Snapshot
Example Files
See the examples/ directory:
examples/
โโโ sample-code.py
โโโ sample-report.html
โโโ sample-report.jpeg
Use Cases
QA Engineers
- Regression Testing
- Smoke Testing
- API Validation
SRE Teams
- Capacity Testing
- Reliability Benchmarking
- SLA Validation
Developers
- Endpoint Benchmarking
- Performance Optimization
DevOps Engineers
- Pre-Deployment Validation
- Infrastructure Load Testing
License
MIT License
Attribution
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hammerapi_tool-0.1.0.tar.gz.
File metadata
- Download URL: hammerapi_tool-0.1.0.tar.gz
- Upload date:
- Size: 293.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
967f55d9959111e5143a411c038f6b20c7bdbac5ae9ce10155a63a2d780528a9
|
|
| MD5 |
5fe26fa16a76be9ffbc38290f0f2344b
|
|
| BLAKE2b-256 |
2c8327633e4ee09531c67ea9ce34bbb41ce4bb41c5765d792a2a627460e5c429
|
File details
Details for the file hammerapi_tool-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hammerapi_tool-0.1.0-py3-none-any.whl
- Upload date:
- Size: 59.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb58c8ee53d308ff15ff3e91529975d0c2f527d4db3d49c9206adbccd1eec120
|
|
| MD5 |
84cf244150a3750112e5019e2df62d9b
|
|
| BLAKE2b-256 |
72574ae9d18718a0a671e9f61bdaeb6a3173bb0fe67cbbf0c4971f28a7e0c7de
|