Spaces:
Sleeping
Sleeping
File size: 775 Bytes
e8510d3 | 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 | import json
import requests
import sys
def test_endpoint(endpoint, params):
print(f"Testing {endpoint} with params {params}")
url = f"http://localhost:10000{endpoint}"
try:
response = requests.get(url, params=params)
if response.status_code == 200:
print("SUCCESS!")
data = response.json()
print(json.dumps(data, indent=2, ensure_ascii=False))
else:
print(f"ERROR: {response.status_code}")
print(response.text)
except Exception as e:
print(f"EXCEPTION: {e}")
if __name__ == "__main__":
if len(sys.argv) > 1:
endpoint = sys.argv[1]
else:
endpoint = "/api/sura"
test_endpoint(endpoint, {"name": "", "date": "2025-06-07"})
|