25 lines
680 B
Python
25 lines
680 B
Python
import requests
|
|
import time
|
|
|
|
def test_endpoint(url):
|
|
print(f"Testing {url}...")
|
|
start = time.time()
|
|
try:
|
|
resp = requests.get(url)
|
|
print(f"Status: {resp.status_code}")
|
|
if resp.status_code == 200:
|
|
print("Success!")
|
|
# print(resp.json()) # Verbose
|
|
else:
|
|
print(f"Error: {resp.text}")
|
|
except Exception as e:
|
|
print(f"Exception: {e}")
|
|
end = time.time()
|
|
print(f"Time taken: {end - start:.4f} seconds\n")
|
|
|
|
if __name__ == "__main__":
|
|
base = "http://localhost:8000/api/lab"
|
|
test_endpoint(f"{base}/kpi")
|
|
test_endpoint(f"{base}/conversions")
|
|
test_endpoint(f"{base}/scatter")
|