File size: 2,420 Bytes
5505d86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python3
"""
Comprehensive test script for Hugging Face Spaces URLs
"""

import requests
import time

def test_hf_urls():
    # All possible Hugging Face Spaces URL patterns
    base_urls = [
        "https://huggingface.co/spaces/Manjesh501/hackrx",
        "https://Manjesh501-hackrx.hf.space",
        "https://hackrx--Manjesh501.hf.space",
        "https://huggingface.co/spaces/Manjesh501/hackrx/app",
        "https://huggingface.co/spaces/Manjesh501/hackrx/demo"
    ]
    
    endpoints = ["", "/health", "/test", "/docs", "/api/v1/hackrx/run"]
    
    print("πŸ§ͺ Testing ALL Hugging Face Spaces URL patterns...")
    print("=" * 60)
    
    working_urls = []
    
    for base_url in base_urls:
        print(f"\nπŸ” Testing base URL: {base_url}")
        print("-" * 40)
        
        for endpoint in endpoints:
            url = base_url + endpoint
            try:
                print(f"  Testing: {url}")
                response = requests.get(url, timeout=15)
                print(f"  βœ… Status: {response.status_code}")
                
                if response.status_code == 200:
                    print(f"  πŸ“„ Response: {response.text[:100]}...")
                    working_urls.append(url)
                elif response.status_code == 404:
                    print(f"  ❌ 404 Not Found")
                elif response.status_code == 302:
                    print(f"  πŸ”„ Redirect (302)")
                else:
                    print(f"  ⚠️ Unexpected status: {response.status_code}")
                    
            except requests.exceptions.ConnectionError:
                print(f"  ❌ Connection failed")
            except requests.exceptions.Timeout:
                print(f"  ⏰ Timeout")
            except Exception as e:
                print(f"  ❌ Error: {e}")
    
    print("\n" + "=" * 60)
    print("🎯 SUMMARY:")
    print("=" * 60)
    
    if working_urls:
        print("βœ… WORKING URLs:")
        for url in working_urls:
            print(f"  - {url}")
    else:
        print("❌ No working URLs found")
    
    print("\nπŸ“‹ RECOMMENDED TESTING:")
    print("1. Check the Hugging Face Spaces interface")
    print("2. Look for an 'App' or 'Demo' tab")
    print("3. Check if the Space is properly configured")
    print("4. Verify the container logs show successful startup")

if __name__ == "__main__":
    test_hf_urls()