Files
AccountForger-neuerUpload/check_rotation_system.py
Claude Project Manager 04585e95b6 Initial commit
2025-08-01 23:50:28 +02:00

154 Zeilen
4.7 KiB
Python

#!/usr/bin/env python3
"""
Quick check script to verify method rotation system status.
Run this to ensure everything is working before starting main.py
"""
import sys
import os
from pathlib import Path
# Add project root to path
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))
def check_imports():
"""Check if all rotation system imports work"""
print("🔍 Checking imports...")
try:
from domain.entities.method_rotation import MethodStrategy, RotationSession
print("✅ Domain entities: OK")
except Exception as e:
print(f"❌ Domain entities: {e}")
return False
try:
from application.use_cases.method_rotation_use_case import MethodRotationUseCase
print("✅ Use cases: OK")
except Exception as e:
print(f"❌ Use cases: {e}")
return False
try:
from controllers.platform_controllers.method_rotation_mixin import MethodRotationMixin
print("✅ Controller mixin: OK")
except Exception as e:
print(f"❌ Controller mixin: {e}")
return False
return True
def check_database():
"""Check database and tables"""
print("\n🗄️ Checking database...")
db_path = project_root / "database" / "accounts.db"
if not db_path.exists():
print(f"❌ Database not found: {db_path}")
return False
print(f"✅ Database found: {db_path}")
try:
import sqlite3
conn = sqlite3.connect(str(db_path))
cursor = conn.cursor()
# Check for rotation tables
cursor.execute("""
SELECT name FROM sqlite_master
WHERE type='table' AND (
name = 'method_strategies' OR
name = 'rotation_sessions' OR
name = 'platform_method_states'
)
""")
tables = [row[0] for row in cursor.fetchall()]
conn.close()
if len(tables) >= 3:
print(f"✅ Rotation tables found: {tables}")
return True
else:
print(f"⚠️ Missing rotation tables. Found: {tables}")
return False
except Exception as e:
print(f"❌ Database check failed: {e}")
return False
def check_config():
"""Check configuration files"""
print("\n⚙️ Checking configuration...")
config_path = project_root / "config" / "method_rotation_config.json"
if config_path.exists():
print("✅ Rotation config found")
return True
else:
print("⚠️ Rotation config not found (will use defaults)")
return True # Not critical
def check_controllers():
"""Check if controllers can be imported"""
print("\n🎮 Checking controllers...")
try:
from controllers.platform_controllers.base_controller import BasePlatformController
print("✅ Base controller: OK")
from controllers.platform_controllers.instagram_controller import InstagramController
print("✅ Instagram controller: OK")
return True
except Exception as e:
print(f"❌ Controller check failed: {e}")
return False
def main():
"""Main check function"""
print("🔧 Method Rotation System - Status Check")
print("=" * 50)
checks = [
("Imports", check_imports),
("Database", check_database),
("Config", check_config),
("Controllers", check_controllers)
]
all_good = True
for name, check_func in checks:
try:
result = check_func()
if not result:
all_good = False
except Exception as e:
print(f"{name} check crashed: {e}")
all_good = False
print("\n" + "=" * 50)
if all_good:
print("✅ Method rotation system is ready!")
print("🚀 You can safely start main.py")
print("\n💡 Expected behavior:")
print(" - Account creation works as before")
print(" - Additional rotation logs will appear")
print(" - Automatic method switching on failures")
print(" - Graceful fallback if any issues occur")
else:
print("⚠️ Some issues detected, but main.py should still work")
print("🔄 Rotation system will fall back to original behavior")
print("\n🛠️ To fix issues:")
print(" 1. Run: python3 run_migration.py")
print(" 2. Check file permissions")
print(" 3. Restart main.py")
print("\n📝 To test rotation manually:")
print(" - Create an account on any platform")
print(" - Check logs for rotation messages")
print(" - Simulate failures to see rotation in action")
if __name__ == "__main__":
main()