mobypark.siudowski.com
Example API call: mobypark.siudowski.com/auth/register
python -m venv .venv/
python3 -m venv .venv/
.\.venv\Scripts\activate
source .venv/bin/activate
source .venv/bin/activate.fish
pip install -r requirements.txt
From root directory, run
python old_api/server.py
You can start the server in any of the following ways:
- Directly run the Python file (no extra commands):
- From project root:
python -m app.main
- From project root:
- Using uvicorn (previous method):
- From
appdirectory:uvicorn app.main:app --reload
- From
pytest old_api/tests.py
Run all commands from the root directory.
pytestAdd -v flag for more verbose output.
If it complains about module 'app' not found:
PYTHONPATH=. pytest -vBut the pytest.ini file should do that automatically.
pytest tests/[filename]- Create a new file in
app/db/models/, seeuser.pyfor example. - Import this file in
app/db/base.py - Make a database migration
- Run these commands in root directory.
alembic -c app/alembic.ini revision --autogenerate -m "message", and choose a fitting message.alembic -c app/alembic.ini upgrade head
- Root
appdirectoryalembicsubdirectory contains configuration for alembic, the database migration tool.apisubdirectory includes API logicauthsubdirectory contains endpoints for login, registering.parking_lotssubdirectory contains endpoints for parking lot management.parking_sessionssubdirectory contains endpoints for parking session management.userssubdirectory contains endpoints for listing users (for admins).
coresubdirectory includes some configuration we can use.dbsubdirectory contains database information and models. In thebase.pyfile, we include data models to be included in migrations.
After you log in at /auth/login, you will receive a JSON response containing a token. You must send this token in the Authorization header when calling protected endpoints like /vehicles.
Header format expected by the server:
- Header name:
Authorization - Header value:
Bearer <your_jwt_token_here>
The backend automatically accepts both raw tokens and the Bearer format, but using the Bearer prefix is recommended and standard.
- Make a POST request to
/auth/loginwith your credentials. - Copy the
tokenvalue from the response. - Create a new request:
GET /vehicles/. - Go to the Headers tab and add:
- Key:
Authorization - Value:
Bearer <paste-your-token>
- Key:
- Send the request. You should receive your vehicles list.
Alternatively in Postman, you can use the Authorization tab:
- Type:
Bearer Token - Token:
<paste-your-token>
If your token is expired, the server will respond with status 498. In that case, log in again to obtain a fresh token.