manage_beli: use uv run and username instead of email

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-17 19:43:15 -04:00
parent f709528def
commit b6b866c9fc
+18 -16
View File
@@ -2,17 +2,17 @@
Manage Beli profiles and restaurant data.
Usage:
python scripts/manage_beli.py add <user_email> <beli_email> <beli_password>
python scripts/manage_beli.py list
python scripts/manage_beli.py refresh <profile_id>
python scripts/manage_beli.py refresh-all
python scripts/manage_beli.py remove <profile_id>
uv run python scripts/manage_beli.py add <username> <beli_email> <beli_password>
uv run python scripts/manage_beli.py list
uv run python scripts/manage_beli.py refresh <profile_id>
uv run python scripts/manage_beli.py refresh-all
uv run python scripts/manage_beli.py remove <profile_id>
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 <user_email> <beli_email> <beli_password>"
"Usage: uv run python scripts/manage_beli.py add <username> <beli_email> <beli_password>"
)
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 <profile_id>")
print(
"Usage: uv run python scripts/manage_beli.py refresh <profile_id>"
)
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 <profile_id>")
print("Usage: uv run python scripts/manage_beli.py remove <profile_id>")
sys.exit(1)
ok = await cmd_remove(sys.argv[2])
sys.exit(0 if ok else 1)