# SPDX-License-Identifier: LGPL-3.0-only # Copyright (c) 2026 Mirrowel import asyncio import sys import argparse from pathlib import Path # Add the 'src' directory to the Python path sys.path.append(str(Path(__file__).resolve().parent)) from rotator_library import provider_factory async def main(): parser = argparse.ArgumentParser(description="Batch authorize multiple Google OAuth accounts.") parser.add_argument("emails", nargs="+", help="List of Gmail addresses to authorize.") parser.add_argument("--provider", default="antigravity", help="Provider to authorize (default: antigravity).") args = parser.parse_args() auth_class = provider_factory.get_provider_auth_class(args.provider) auth_instance = auth_class() print(f"šŸš€ Starting batch authorization for {len(args.emails)} accounts on {args.provider}...") for email in args.emails: print(f"\nšŸ”‘ Setting up: {email}") result = await auth_instance.setup_credential(login_hint=email) if result.success: print(f"āœ… Success! Saved to: {Path(result.file_path).name}") if result.is_update: print(f"ā„¹ļø Updated existing credential for {result.email}") else: print(f"āŒ Failed: {result.error}") print("\n✨ Batch authorization complete!") print("šŸ‘‰ Now run 'python -m rotator_library.credential_tool' and choose 'Export to .env' to get your tokens.") if __name__ == "__main__": asyncio.run(main())