This project has been archived by its maintainers, and is no longer receiving any updates.
`falcon-stats` is a simple usage statistics middleware for the [Falcon REST framework](https://falconframework.org/). It should primarily enable later analysis that separately gets relevant data from the DB.
## Data Collection
*Falcon Stats* gathers data on incoming requests and their processed responses. Currently the following features are saved:
- Response Timestamp
- Processing Time between Request and Response
- Request Method
- User Agent
- Request URI (domain, endpoint and query string)
- Remote IP (closest to the server)
- Request Content-Type
- Response Status
- Request Content Length
Note that logging and database access add overhead to the processing time. Furthermore it will add a few milliseconds on every response.
## Installation
... is as easy as
```
pip install falcon-stats
```
Installation assumes you have the packages found in *requirements.txt* installed. Please note the development build of SQLAlchemy that is pulled from the official git repository.
## Usage
In your main falcon file import the `FalconStatsMiddleware` and add it to the middleware list of your API instance. That's it.
```python
from falconstats import FalconStatsMiddleware
...
fsm = FalconStatsMiddleware(
db_user="root",
db_pass="my-secret-pw",
db_addr="localhost:3306",
db_name="stats"
)
app = falcon.API(middleware=[fsm])
```
This will connect to the given MySQL database and start to add request-response data. For now only MySQL is supported - *PRs welcome*!
## Compatibility
The middleware is used with Python 3.5 and 3.6. I don't plan on supporting Python 2.7 but it still might work.
Metadata
Release files for falcon-stats 0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| falcon_stats-0.5-py3-none-any.whl | Python 3 | none | any | Details for falcon_stats-0.5-py3-none-any.whl |
Release files / falcon_stats-0.5-py3-none-any.whl
| Download URL | falcon_stats-0.5-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c75f9a2ab18715503075dc9dce2114f4dff148a4288d37ed22b18175b9703377
|
|
BLAKE2b-256 checksum How to use checksums |
849f4287ed56d908d7bf209fd46fe9904bf9c85aa3aad91681d05bbcf875d96a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for falcon-stats 0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.