test-repo/verify-scrapling-setup.py

76 lines
2.3 KiB
Python

#!/usr/bin/env python3
"""
Quick verification that Scrapling is properly installed and configured
"""
import sys
import subprocess
def check_command(cmd, description):
"""Check if a command is available"""
try:
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
if result.returncode == 0:
print(f"{description}")
return True
else:
print(f"{description}")
print(f" Error: {result.stderr.strip()}")
return False
except Exception as e:
print(f"{description}")
print(f" Exception: {e}")
return False
def main():
print("🔍 Verifying Scrapling Setup for OpenClaw Integration")
print("=" * 55)
checks_passed = 0
total_checks = 0
# Check Python
total_checks += 1
if check_command("python3 --version", "Python 3 available"):
checks_passed += 1
# Check pip
total_checks += 1
if check_command("python3 -m pip --version", "pip available"):
checks_passed += 1
# Check Scrapling CLI
total_checks += 1
if check_command("scrapling --help", "Scrapling CLI available"):
checks_passed += 1
# Check fetchers via CLI
total_checks += 1
if check_command("scrapling extract stealthy-fetch --help", "Scrapling stealthy-fetch available"):
checks_passed += 1
# Check integration script
total_checks += 1
if check_command("python3 scrapling-integration.py --help | head -1", "Integration script executable"):
checks_passed += 1
# Check test script
total_checks += 1
if check_command("./test-scrapling-workflow.sh --help 2>/dev/null || echo 'Script exists'", "Test workflow script exists"):
checks_passed += 1
print(f"\n📊 Results: {checks_passed}/{total_checks} checks passed")
if checks_passed == total_checks:
print("🎉 All checks passed! Scrapling is ready for OpenClaw integration.")
print("\n🚀 Run the full test suite:")
print(" ./test-scrapling-workflow.sh")
return 0
else:
print("⚠️ Some checks failed. Run installation and try again.")
print("\n🔧 Installation:")
print(" ./install-scrapling.sh")
return 1
if __name__ == "__main__":
sys.exit(main())