monitor api request count
Project description
Django-request-counter
Install this app to get django api request count
Installation
Install my-project with pip
pip install request-counter
In settings.py add below Add the app in installed apps
INSTALLED_APPS = [
...
"request_counter",
]
Add middleware
MIDDLEWARE = [
...
"request_counter.middlewares.APICounterMiddleware",
]
To check using API Add
urlpartterns = [
...
path("",include("request_counter.urls")),
]
Set Redis Url
# REDIS_URL = "redis://localhost:6379/7" # by default
REDIS_URL = "<your redis url path>"
API_START_PATH = "/api/" # by default set "" for monitoring all path
API_START_PATH = "<your starting path>"
You need to setup cron to periodically save the data into default database
python manage.py store_api_count
Now make api request with admin user
curl --location '<base-url>/api-count/' \
--header '<your authentication header>'
curl --location '<base-url>/api-count/redis' \
--header '<your authentication header>'
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
request-counter-1.3.0.tar.gz
(5.2 kB
view hashes)
Built Distribution
Close
Hashes for request_counter-1.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e737a115cc81ec2f76d2635fca92b11b8ec085ca491d56765254c511e2d7a91d |
|
MD5 | e6f753c97ef2bc130380b0cc37b24a6e |
|
BLAKE2b-256 | b81adb6e3af16e1162c329ceb88873feab988d47492c7b9b30570743f9f11ed7 |