Spaces:
Sleeping
Sleeping
File size: 1,507 Bytes
260d3dd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # 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())
|