https://github.com/c-bata/django-httpbench
HTTP load testing tools for Django. Like an apache bench but requests are sent from authenticated users.
https://github.com/c-bata/django-httpbench
django load-testing
Last synced: 12 months ago
JSON representation
HTTP load testing tools for Django. Like an apache bench but requests are sent from authenticated users.
- Host: GitHub
- URL: https://github.com/c-bata/django-httpbench
- Owner: c-bata
- License: mit
- Created: 2019-05-01T04:53:54.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-06T12:02:52.000Z (about 7 years ago)
- Last Synced: 2025-05-18T14:17:19.582Z (about 1 year ago)
- Topics: django, load-testing
- Language: Python
- Size: 23.4 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
django-httpbench
================
HTTP load testing tools for Django.
Like an apache bench but requests are sent from authenticated users without having to know their password.
Installation
------------
django-httpbench requires python 3.6 or later and Django 2.0 or later.
.. code-block:: console
$ python3 -m pip install djangohttpbench
https://pypi.org/project/djangohttpbench/
Usage
-----
HeaderAuthBackend
~~~~~~~~~~~~~~~~~
Django authentication backend that allows one to login without having to know their password.
This backend is useful for testing scenarios.
.. code-block:: python
HTTP_BENCH_USERNAME_KEY = "X-USERNAME" # default: X-USERNAME
INSTALLED_APPS += [
'httpbench.apps.HttpbenchConfig',
]
MIDDLEWARE += [
'httpbench.middlewares.HeaderAuthMiddleware',
]
AUTHENTICATION_BACKENDS += [
'httpbench.backends.UsernameBackend',
]
.. code-block:: console
$ curl -H 'X-USERNAME: c-bata' https://localhost:8000/path/to/page/require/auth
``httpbench`` management command
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`httpbench` management command acts like an apache bench but requests are sent from authenticated users.
.. code-block:: console
$ python3 manage.py httpbench -n 1000 -c 50 \
> --username c-bata \
> https://localhost:8000/
Response time:
mean: 3.862 secs
min: 1.173 secs
max: 11.097 secs
Status:
2xx: 1000
3xx: 0
4xx: 0
5xx: 0
fail: 0
Development
-----------
* lint: ``tox -e flake8`` or ``flake8``
* test: ``tox -e py37`` or ``python setup.py test --settings=test_settings``
License
-------
This software is licensed under the MIT License (See `LICENSE <./LICENSE>`_ ).