llm-proxy-rotate / src /batch_auth.py
bardd's picture
Upload 144 files
260d3dd verified
# 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())