This package can be used to gather API request & response data from Rack based applications and send it to Callcounter.
Callcounter is an API analytics platform that collect information about requests (calls) to your API using so-called integrations. Integrations come in the form of a Ruby gem, a Nuget package, a Pip module, etcetera. The integrations can send the data to Callcounter using an API, which is described at: https://callcounter.eu/pages/api
After collection data, the web interface can then be used to view all kinds of metrics, giving you insight in the (mis)usage of your API.
Install the package with pip:
pip install callcounter.
In you django
settings.py add the following lines:
import callcounter callcounter.project_token = '' # TODO: fill with your unique project token
And add the middleware to the
MIDDLEWARE array in the same settings.py:
MIDDLEWARE = [ # other middleware kept here 'callcounter.middleware.Capturer', ]
This will capture any requests to the
api subdomain and any request that has a path which starts with
After deploying you should start seeing data in Callcounter. Note that this might take some time because this gems
only sends data every few requests or every few minutes.
If you API doesn't match with the default matching rules, you can add a lambda that will be called for every request to determine whether it was a request to your API. For example, you can customize the default lambda shown below:
callcounter.track = lambda request: request.get_host().startswith('api.') or request.path.startswith('/api')
Bugs can be reported through the Sourcehut todo lists found at: https://todo.sr.ht/~webindie/callcounter-pip If you don't want to sign up for an account, you can also contact us through https://callcounter.eu/contact
python3 -m build
python3 -m twine upload dist/*