hammerAPI 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,218 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shayan Saha
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,450 @@
1
+ Metadata-Version: 2.4
2
+ Name: hammerAPI
3
+ Version: 0.1.0
4
+ Summary: 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.
5
+ Project-URL: Homepage, https://github.com/shayansaha85/hammerAPI
6
+ Author-email: Shayan <shayan851997@gmail.com>
7
+ License: MIT
8
+ License-File: LICENSE
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.8
13
+ Requires-Dist: httpx>=0.24.0
14
+ Requires-Dist: psutil>=5.9.0
15
+ Description-Content-Type: text/markdown
16
+
17
+ <p align="center">
18
+ <img src="logo_readme.png" alt="hammerAPI">
19
+ </p>
20
+
21
+
22
+ [![Python Version](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://pypi.org/project/hammerapi/)
23
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
24
+
25
+ A lightweight, blazing-fast, multi-threaded API performance and load testing library for Python.
26
+
27
+ **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.
28
+
29
+ ---
30
+
31
+ ## 🚀 Installation
32
+
33
+ ```bash
34
+ pip install hammerapi
35
+ ```
36
+
37
+ ---
38
+
39
+ ## ✨ Features
40
+
41
+ ### 🧵 Concurrent API Execution
42
+
43
+ Run hundreds or thousands of requests using a configurable thread pool.
44
+
45
+ ### ⏱️ Multiple Execution Modes
46
+
47
+ * Run each test case exactly once
48
+ * Run continuously for a fixed duration
49
+ * Mix multiple endpoints in the same workload
50
+
51
+ ### 🌐 Full HTTP Support
52
+
53
+ Supports:
54
+
55
+ * GET
56
+ * POST
57
+ * PUT
58
+ * PATCH
59
+ * DELETE
60
+
61
+ ### 🔐 Authentication Support
62
+
63
+ Works with:
64
+
65
+ * Bearer Tokens
66
+ * API Keys
67
+ * Custom Headers
68
+ * Session Cookies
69
+
70
+ ### 📊 Performance Metrics
71
+
72
+ Automatically captures:
73
+
74
+ * Response Time
75
+ * Success / Failure Counts
76
+ * Request Throughput
77
+ * Average Latency
78
+ * P90 Latency
79
+ * P95 Latency
80
+ * P99 Latency
81
+
82
+ ### 🖥️ System Resource Monitoring
83
+
84
+ Captures local machine:
85
+
86
+ * CPU Utilization
87
+ * RAM Utilization
88
+ * Operating System Information
89
+
90
+ ### 📈 Interactive HTML Dashboard
91
+
92
+ Generate beautiful standalone reports with:
93
+
94
+ * Charts
95
+ * Percentiles
96
+ * Error Analysis
97
+ * Resource Consumption Trends
98
+ * Request Distribution
99
+
100
+ ### 🌍 Cross Platform
101
+
102
+ Works on:
103
+
104
+ * Windows
105
+ * Linux
106
+ * macOS
107
+
108
+ ---
109
+
110
+ # 📁 Project Structure
111
+
112
+ ```text
113
+ hammerAPI/
114
+ ├── LICENSE
115
+ ├── README.md
116
+ ├── pyproject.toml
117
+ ├── logo.png
118
+ ├── logo_readme.png
119
+ ├── src/
120
+ │ └── hammerapi/
121
+ │ ├── __init__.py
122
+ │ ├── monitor.py
123
+ │ ├── reporter.py
124
+ │ └── runner.py
125
+ └── examples/
126
+ ├── sample-code.py
127
+ ├── sample-report.html
128
+ └── sample-report.jpeg
129
+ ```
130
+
131
+ ---
132
+
133
+ # Quick Start
134
+
135
+ ## Simple GET Request
136
+
137
+ ```python
138
+ from hammerapi import HammerAPI
139
+
140
+ hammer = HammerAPI(max_workers=5)
141
+
142
+ hammer.add_test(
143
+ method="GET",
144
+ url="https://jsonplaceholder.typicode.com/posts/1"
145
+ )
146
+
147
+ hammer.run()
148
+
149
+ hammer.generate_report()
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Multiple Endpoints
155
+
156
+ ```python
157
+ from hammerapi import HammerAPI
158
+
159
+ hammer = HammerAPI(max_workers=10)
160
+
161
+ hammer.add_test(
162
+ "GET",
163
+ "https://jsonplaceholder.typicode.com/posts/1"
164
+ )
165
+
166
+ hammer.add_test(
167
+ "GET",
168
+ "https://jsonplaceholder.typicode.com/users/1"
169
+ )
170
+
171
+ hammer.add_test(
172
+ "GET",
173
+ "https://jsonplaceholder.typicode.com/comments/1"
174
+ )
175
+
176
+ hammer.run()
177
+
178
+ hammer.generate_report()
179
+ ```
180
+
181
+ ---
182
+
183
+ ## POST Request with JSON Payload
184
+
185
+ ```python
186
+ from hammerapi import HammerAPI
187
+
188
+ hammer = HammerAPI()
189
+
190
+ hammer.add_test(
191
+ method="POST",
192
+ url="https://jsonplaceholder.typicode.com/posts",
193
+ json={
194
+ "title": "HammerAPI",
195
+ "body": "Load Testing",
196
+ "userId": 1
197
+ }
198
+ )
199
+
200
+ hammer.run()
201
+ hammer.generate_report()
202
+ ```
203
+
204
+ ---
205
+
206
+ ## Authenticated API Testing
207
+
208
+ ```python
209
+ from hammerapi import HammerAPI
210
+
211
+ hammer = HammerAPI()
212
+
213
+ hammer.add_test(
214
+ method="GET",
215
+ url="https://api.example.com/users",
216
+ headers={
217
+ "Authorization": "Bearer YOUR_TOKEN"
218
+ }
219
+ )
220
+
221
+ hammer.run()
222
+ ```
223
+
224
+ ---
225
+
226
+ ## API Key Authentication
227
+
228
+ ```python
229
+ from hammerapi import HammerAPI
230
+
231
+ hammer = HammerAPI()
232
+
233
+ hammer.add_test(
234
+ method="GET",
235
+ url="https://api.example.com/data",
236
+ headers={
237
+ "x-api-key": "YOUR_API_KEY"
238
+ }
239
+ )
240
+
241
+ hammer.run()
242
+ ```
243
+
244
+ ---
245
+
246
+ ## Query Parameters
247
+
248
+ ```python
249
+ from hammerapi import HammerAPI
250
+
251
+ hammer = HammerAPI()
252
+
253
+ hammer.add_test(
254
+ method="GET",
255
+ url="https://api.example.com/search",
256
+ params={
257
+ "page": 1,
258
+ "limit": 100
259
+ }
260
+ )
261
+
262
+ hammer.run()
263
+ ```
264
+
265
+ ---
266
+
267
+ ## Custom Headers
268
+
269
+ ```python
270
+ from hammerapi import HammerAPI
271
+
272
+ hammer = HammerAPI()
273
+
274
+ hammer.add_test(
275
+ method="GET",
276
+ url="https://api.example.com/data",
277
+ headers={
278
+ "Environment": "QA",
279
+ "Client": "HammerAPI"
280
+ }
281
+ )
282
+
283
+ hammer.run()
284
+ ```
285
+
286
+ ---
287
+
288
+ ## PUT Request
289
+
290
+ ```python
291
+ hammer.add_test(
292
+ method="PUT",
293
+ url="https://api.example.com/user/1",
294
+ json={
295
+ "name": "John Doe"
296
+ }
297
+ )
298
+ ```
299
+
300
+ ---
301
+
302
+ ## PATCH Request
303
+
304
+ ```python
305
+ hammer.add_test(
306
+ method="PATCH",
307
+ url="https://api.example.com/user/1",
308
+ json={
309
+ "status": "active"
310
+ }
311
+ )
312
+ ```
313
+
314
+ ---
315
+
316
+ ## DELETE Request
317
+
318
+ ```python
319
+ hammer.add_test(
320
+ method="DELETE",
321
+ url="https://api.example.com/user/1"
322
+ )
323
+ ```
324
+
325
+ ---
326
+
327
+ # 🔥 Load Testing For Fixed Duration
328
+
329
+ Continuously hit endpoints for a specific duration.
330
+
331
+ ```python
332
+ from hammerapi import HammerAPI
333
+
334
+ hammer = HammerAPI(max_workers=25)
335
+
336
+ hammer.add_test(
337
+ "GET",
338
+ "https://api.example.com/health"
339
+ )
340
+
341
+ hammer.run(duration_seconds=60)
342
+
343
+ hammer.generate_report("load_test_report.html")
344
+ ```
345
+
346
+ This will continuously execute requests across 25 worker threads for 60 seconds.
347
+
348
+ ---
349
+
350
+ # ⚡ High Concurrency Example
351
+
352
+ ```python
353
+ from hammerapi import HammerAPI
354
+
355
+ hammer = HammerAPI(max_workers=100)
356
+
357
+ hammer.add_test(
358
+ "GET",
359
+ "https://api.example.com/health"
360
+ )
361
+
362
+ hammer.run(duration_seconds=120)
363
+ ```
364
+
365
+ Perfect for:
366
+
367
+ * Load Testing
368
+ * Stress Testing
369
+ * Smoke Testing
370
+ * Capacity Planning
371
+
372
+ ---
373
+
374
+ # 📄 Generate Report
375
+
376
+ ```python
377
+ hammer.generate_report(
378
+ output_path="hammer_report.html"
379
+ )
380
+ ```
381
+
382
+ Generated report includes:
383
+
384
+ * Total Requests
385
+ * Success Rate
386
+ * Failure Rate
387
+ * Average Response Time
388
+ * P90 Latency
389
+ * P95 Latency
390
+ * P99 Latency
391
+ * CPU Utilization
392
+ * RAM Utilization
393
+ * Throughput Analysis
394
+
395
+ ---
396
+
397
+ # Report Snapshot
398
+
399
+ ![report\_snapshot](examples/sample-report.jpeg)
400
+
401
+ ---
402
+
403
+ # Example Files
404
+
405
+ See the `examples/` directory:
406
+
407
+ ```text
408
+ examples/
409
+ ├── sample-code.py
410
+ ├── sample-report.html
411
+ └── sample-report.jpeg
412
+ ```
413
+
414
+ ---
415
+
416
+ # Use Cases
417
+
418
+ ### QA Engineers
419
+
420
+ * Regression Testing
421
+ * Smoke Testing
422
+ * API Validation
423
+
424
+ ### SRE Teams
425
+
426
+ * Capacity Testing
427
+ * Reliability Benchmarking
428
+ * SLA Validation
429
+
430
+ ### Developers
431
+
432
+ * Endpoint Benchmarking
433
+ * Performance Optimization
434
+
435
+ ### DevOps Engineers
436
+
437
+ * Pre-Deployment Validation
438
+ * Infrastructure Load Testing
439
+
440
+ ---
441
+
442
+ # License
443
+
444
+ MIT License
445
+
446
+ ---
447
+
448
+ ### Attribution
449
+
450
+ <a href="https://www.flaticon.com/free-icons/hammer" title="hammer icons">Hammer icons created by nawicon - Flaticon</a>