diff --git a/scripts/manage_beli.py b/scripts/manage_beli.py index 38f6d32..7a686b4 100644 --- a/scripts/manage_beli.py +++ b/scripts/manage_beli.py @@ -2,17 +2,17 @@ Manage Beli profiles and restaurant data. Usage: - python scripts/manage_beli.py add - python scripts/manage_beli.py list - python scripts/manage_beli.py refresh - python scripts/manage_beli.py refresh-all - python scripts/manage_beli.py remove + uv run python scripts/manage_beli.py add + uv run python scripts/manage_beli.py list + uv run python scripts/manage_beli.py refresh + uv run python scripts/manage_beli.py refresh-all + uv run python scripts/manage_beli.py remove Examples: - python scripts/manage_beli.py add ryan@torrtle.co me@gmail.com mybelipass - python scripts/manage_beli.py list - python scripts/manage_beli.py refresh 3f2a1b... - python scripts/manage_beli.py refresh-all + uv run python scripts/manage_beli.py add ryan me@gmail.com mybelipass + uv run python scripts/manage_beli.py list + uv run python scripts/manage_beli.py refresh 3f2a1b... + uv run python scripts/manage_beli.py refresh-all """ import asyncio @@ -54,15 +54,15 @@ async def _close(): await Tortoise.close_connections() -async def cmd_add(user_email: str, beli_email: str, beli_password: str): +async def cmd_add(username: str, beli_email: str, beli_password: str): from blueprints.beli.logic import MAX_PROFILES_PER_USER from blueprints.beli.models import BeliProfile from blueprints.users.models import User from utils.beli_service import authenticate - user = await User.get_or_none(email=user_email) + user = await User.get_or_none(username=username) if not user: - print(f"Error: no user with email '{user_email}'") + print(f"Error: no user with username '{username}'") return False count = await BeliProfile.filter(user=user).count() @@ -94,7 +94,7 @@ async def cmd_add(user_email: str, beli_email: str, beli_password: str): print(f"Profile created: {profile.id}") print(f" Beli user ID : {profile.beli_user_id}") print(f" Beli email : {profile.beli_email}") - print(f" Owner : {user_email}") + print(f" Owner : {username}") return True @@ -198,7 +198,7 @@ async def main(): if cmd == "add": if len(sys.argv) != 5: print( - "Usage: manage_beli.py add " + "Usage: uv run python scripts/manage_beli.py add " ) sys.exit(1) ok = await cmd_add(sys.argv[2], sys.argv[3], sys.argv[4]) @@ -209,7 +209,9 @@ async def main(): elif cmd == "refresh": if len(sys.argv) != 3: - print("Usage: manage_beli.py refresh ") + print( + "Usage: uv run python scripts/manage_beli.py refresh " + ) sys.exit(1) ok = await cmd_refresh(sys.argv[2]) sys.exit(0 if ok else 1) @@ -219,7 +221,7 @@ async def main(): elif cmd == "remove": if len(sys.argv) != 3: - print("Usage: manage_beli.py remove ") + print("Usage: uv run python scripts/manage_beli.py remove ") sys.exit(1) ok = await cmd_remove(sys.argv[2]) sys.exit(0 if ok else 1)