| import requests |
| import time |
| import json |
|
|
| print("=" * 60) |
| print("🚀 HUGGING FACE DEPLOYMENT VERIFICATION") |
| print("=" * 60) |
| print() |
|
|
| BASE_URL = "https://ubuntu593-alt-scraper-api.hf.space" |
|
|
| |
| print("Test 1: Health Check") |
| print(f"URL: {BASE_URL}/health") |
| try: |
| r = requests.get(f"{BASE_URL}/health", timeout=10) |
| print(f"Status: {r.status_code}") |
| print(f"Response: {r.text}") |
| if r.status_code == 200: |
| print("✅ PASSED") |
| else: |
| print("❌ FAILED") |
| except Exception as e: |
| print(f"❌ ERROR: {e}") |
| print() |
|
|
| |
| print("Test 2: System Status") |
| print(f"URL: {BASE_URL}/api/status") |
| try: |
| r = requests.get(f"{BASE_URL}/api/status", timeout=10) |
| print(f"Status: {r.status_code}") |
| if r.status_code == 200: |
| print(f"Response: {json.dumps(r.json(), indent=2)}") |
| print("✅ PASSED") |
| else: |
| print(f"Response: {r.text[:200]}") |
| print("❌ FAILED") |
| except Exception as e: |
| print(f"❌ ERROR: {e}") |
| print() |
|
|
| |
| print("Test 3: Start Scan (Query Parameters)") |
| print(f"URL: {BASE_URL}/api/scanstart?domain=https://example.com&limit=3") |
| try: |
| r = requests.post(f"{BASE_URL}/api/scanstart?domain=https://example.com&limit=3", timeout=10) |
| print(f"Status: {r.status_code}") |
| if r.status_code == 200: |
| response = r.json() |
| print(f"Response: {json.dumps(response, indent=2)}") |
| print("✅ PASSED") |
| job_id = response.get("job_id") |
| |
| if job_id: |
| |
| print() |
| print("Test 4: Check Progress") |
| print(f"URL: {BASE_URL}/api/progress?job_id={job_id}") |
| time.sleep(2) |
| r2 = requests.get(f"{BASE_URL}/api/progress?job_id={job_id}", timeout=10) |
| print(f"Status: {r2.status_code}") |
| if r2.status_code == 200: |
| print(f"Response: {json.dumps(r2.json(), indent=2)}") |
| print("✅ PASSED") |
| else: |
| print(f"Response: {r2.text[:200]}") |
| print("❌ FAILED") |
| else: |
| print(f"Response: {r.text[:300]}") |
| print("❌ FAILED - This is the issue you're seeing!") |
| print() |
| print("💡 SOLUTION:") |
| print("1. Go to: https://huggingface.co/spaces/ubuntu593/alt-scraper-api/settings") |
| print("2. Scroll down to find 'Factory Reboot' button") |
| print("3. Click it and wait 3-5 minutes for rebuild") |
| print("4. Run this script again") |
| except Exception as e: |
| print(f"❌ ERROR: {e}") |
| print() |
|
|
| |
| print("Test 5: Start Scan (JSON Body)") |
| print(f"URL: {BASE_URL}/api/scanstart") |
| try: |
| r = requests.post( |
| f"{BASE_URL}/api/scanstart", |
| json={"domain": "https://example.com", "limit": 3}, |
| timeout=10 |
| ) |
| print(f"Status: {r.status_code}") |
| if r.status_code == 200: |
| print(f"Response: {json.dumps(r.json(), indent=2)}") |
| print("✅ PASSED") |
| else: |
| print(f"Response: {r.text[:200]}") |
| print("❌ FAILED") |
| except Exception as e: |
| print(f"❌ ERROR: {e}") |
| print() |
|
|
| print("=" * 60) |
| print("VERIFICATION COMPLETE") |
| print("=" * 60) |
| print() |
| print("If you see 404 errors above:") |
| print("→ Your HF Space needs to rebuild with latest code") |
| print("→ Follow the solution steps shown above") |
| print() |
| print("If all tests pass:") |
| print("→ Your deployment is working perfectly! ✅") |
|
|