File size: 1,697 Bytes
cbcbcd3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1d14811
 
 
 
cbcbcd3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import requests
import json

# Base URL of your Space
BASE_URL = "https://urjob-test.hf.space"

# The JWT token from your logs
HF_SIGN = "eyJhbGciOiJFZERTQSJ9.eyJyZWFkIjp0cnVlLCJwZXJtaXNzaW9ucyI6eyJyZXBvLmNvbnRlbnQucmVhZCI6dHJ1ZX0sIm9uQmVoYWxmT2YiOnsia2luZCI6InVzZXIiLCJfaWQiOiI2N2FiYzRmMDQxMjM1ODI0NDQyNDQwNmUiLCJ1c2VyIjoiaGliYXRvcnJhaG1lbiIsInNlc3Npb25JZCI6IjY4MmM0MjUyZTE3MzJjNzZiNGM1MjdlOCJ9LCJpYXQiOjE3NDc5NTMxODMsInN1YiI6Ii9zcGFjZXMvdXJqb2IvdGVzdCIsImV4cCI6MTc0ODAzOTU4MywiaXNzIjoiaHR0cHM6Ly9odWdnaW5nZmFjZS5jbyJ9.9Ukimz1w0j8hAohN7HxGbadMPD0FZpDMYFuSHTxFByOA8HtMG3U-HuZNs2sSo3reqnb3gkKgZx0d_99VaWmFAQ"

def test_root():
    """Test the root endpoint with HF Space sign"""
    params = {
        "__sign": HF_SIGN
    }
    response = requests.get(f"{BASE_URL}/", params=params)
    print("\nRoot Endpoint (/) Response:", response.status_code)
    print(response.json() if response.ok else response.text)

def test_basic_health():
    """Test the basic health endpoint"""
    params = {
        "__sign": HF_SIGN
    }
    response = requests.get(f"{BASE_URL}/health", params=params)
    print("\nBasic Health Endpoint (/health) Response:", response.status_code)
    print(response.json() if response.ok else response.text)

def test_api_health():
    """Test the API health endpoint with HF Space sign"""
    params = {
        "__sign": HF_SIGN
    }
    response = requests.get(f"{BASE_URL}/health/api", params=params)
    print("\nAPI Health Endpoint (/health/api) Response:", response.status_code)
    print(response.json() if response.ok else response.text)

if __name__ == "__main__":
    print("Testing API endpoints...")
    test_root()
    test_basic_health()
    test_api_health()