FastAPI visitor statistics with middleware and stats page
Project description
fastapi-stats-page
usage
from fastapi import FastAPI
from fastapi_stats_page import StatsRouter, TrackVisitsMiddleware
app = FastAPI()
app.include_router(StatsRouter(title="Statistics of website").router)
app.add_middleware(TrackVisitsMiddleware)
@app.get("/")
async def homepage():
return "hello world"
this will save visitors ip and user agens to a list
you can also save visitors to a file by doing this
from fastapi import FastAPI
from fastapi_stats_page import StatsRouter, TrackVisitsMiddleware
app = FastAPI()
app.include_router(StatsRouter(title="Statistics of website", get_from="users.txt").router)
app.add_middleware(TrackVisitsMiddleware, save_to="users.txt")
@app.get("/")
async def homepage():
return "hello world"
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_stats_page-0.1.6.tar.gz.
File metadata
- Download URL: fastapi_stats_page-0.1.6.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d03f8ad342086113a1498c02a30fe6b7c44f93eeb35f72c3610c163b16957d78
|
|
| MD5 |
0892f2a7da4ab07f60c04950ed847189
|
|
| BLAKE2b-256 |
82a37992f0d487d44b708daa61ac6e15648f9c9d36b2a922f5958382c00ba834
|
File details
Details for the file fastapi_stats_page-0.1.6-py3-none-any.whl.
File metadata
- Download URL: fastapi_stats_page-0.1.6-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60c2ce46e7689738d6651941afddd66259d03ea8f4f91ac563e6984d747ad215
|
|
| MD5 |
2248e6b57721280c3430e369ff8e3994
|
|
| BLAKE2b-256 |
2e074d08cb85a7533f83f29fcd1afdb606a93e9fc09fa0cb8e247892763d4c47
|