File size: 602 Bytes
bbd2266
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import requests

BASE_URL = "https://amit0987-song-json-api-hf.hf.space"  # Replace with your actual Space URL

def safe_print_json(response, label):
    print(f"{label} -> {response.status_code}")
    try:
        print(response.json())
    except Exception:
        print("Response is not JSON:")
        print(response.text)

def test_root():
    response = requests.get(f"{BASE_URL}/")
    safe_print_json(response, "GET /")

def test_songs():
    response = requests.get(f"{BASE_URL}/songs")
    safe_print_json(response, "GET /songs")

if __name__ == "__main__":
    test_root()
    test_songs()