Spaces:
Runtime error
Runtime error
| # PATH: bot/integrations/cf_worker1.py | |
| from bot.config import Workers | |
| from bot.integrations.http import post_json | |
| def _h(): | |
| return {"Authorization": f"Bearer {Workers.BOT_BACKEND_KEY}", "Content-Type": "application/json"} | |
| async def profile_add(tg_id: int, client_id: str, client_secret: str, label: str = "main", ttl_sec: int = 600) -> dict: | |
| return await post_json( | |
| f"{Workers.WORKER1_URL}/api/profile/add", | |
| _h(), | |
| {"tg_id": str(tg_id), "client_id": client_id, "client_secret": client_secret, "label": label, "ttl_sec": ttl_sec}, | |
| ) | |
| async def profile_list(tg_id: int) -> dict: | |
| return await post_json(f"{Workers.WORKER1_URL}/api/profile/list", _h(), {"tg_id": str(tg_id)}) | |
| async def profile_set_default(tg_id: int, profile_id: str) -> dict: | |
| return await post_json(f"{Workers.WORKER1_URL}/api/profile/set_default", _h(), {"tg_id": str(tg_id), "profile_id": profile_id}) |