Spaces:
Sleeping
Sleeping
Download test_admin_stats.py from hisham-cmd/VortexCommerceBackend: direct link, hf CLI and curl.
- Browser
- Download file 596 Bytes
-
https://huggingface.co/spaces/hisham-cmd/VortexCommerceBackend/resolve/5bf519cdfd82cc4e05fc313fdd730c717cc42a4e/test_admin_stats.py
- Command line
-
hf download hf://spaces/hisham-cmd/VortexCommerceBackend@5bf519cdfd82cc4e05fc313fdd730c717cc42a4e/test_admin_stats.py
-
curl -L -o test_admin_stats.py https://huggingface.co/spaces/hisham-cmd/VortexCommerceBackend/resolve/5bf519cdfd82cc4e05fc313fdd730c717cc42a4e/test_admin_stats.py
596 Bytes
| import os | |
| import sys | |
| sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__)))) | |
| from app.db.base import SessionLocal | |
| from app.api.admin import get_dashboard_stats, get_chart_data | |
| def run(): | |
| db = SessionLocal() | |
| try: | |
| res1 = get_dashboard_stats(1, db) | |
| print("Success stats:", res1) | |
| res2 = get_chart_data(1, db) | |
| print("Success charts:", len(res2["value"]), "days of data") | |
| except Exception as e: | |
| print("Error:", e) | |
| finally: | |
| db.close() | |
| if __name__ == "__main__": | |
| run() | |