Spaces:
Running
Running
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() | |