Spaces:
Running
Running
Download sample_repo/api.py from itssoumyad/graphrag-codeaudit: direct link, hf CLI and curl.
- Browser
- Download file 556 Bytes
-
https://huggingface.co/spaces/itssoumyad/graphrag-codeaudit/resolve/main/sample_repo/api.py
- Command line
-
hf download hf://spaces/itssoumyad/graphrag-codeaudit/sample_repo/api.py
-
curl -L -o api.py https://huggingface.co/spaces/itssoumyad/graphrag-codeaudit/resolve/main/sample_repo/api.py
556 Bytes
| """API layer that ties authentication, database, and files together.""" | |
| from auth import issue_token, verify_password | |
| from db import find_user, save_user | |
| from files import load_snapshot | |
| def login(email: str, password: str): | |
| rows = find_user(email) | |
| if rows and verify_password(password, rows[0][1]): | |
| return {"token": issue_token(str(rows[0][0]))} | |
| return {"error": "invalid credentials"} | |
| def restore_snapshot(path: str): | |
| return load_snapshot(path) | |
| def register(email: str): | |
| save_user(email) | |
| return {"status": "created"} | |