Spaces:
Sleeping
Sleeping
cjell commited on
Commit ·
a3fe9c3
1
Parent(s): 188e503
debug test
Browse files- debug_test.py +43 -0
debug_test.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
import json
|
| 3 |
+
|
| 4 |
+
BASE_URLS = [
|
| 5 |
+
"https://spam-fastapi-cjell.hf.space",
|
| 6 |
+
"https://spam-fastapi-cjell.hf.space/api",
|
| 7 |
+
"https://spam-fastapi-cjell.hf.space/docs",
|
| 8 |
+
]
|
| 9 |
+
|
| 10 |
+
for base_url in BASE_URLS:
|
| 11 |
+
print(f"\n🔹 Testing URL: {base_url}")
|
| 12 |
+
|
| 13 |
+
try:
|
| 14 |
+
# Test GET request
|
| 15 |
+
print(f" GET {base_url}")
|
| 16 |
+
resp = requests.get(base_url, timeout=10)
|
| 17 |
+
print(f" Status: {resp.status_code}")
|
| 18 |
+
print(f" Content-Type: {resp.headers.get('content-type', 'N/A')}")
|
| 19 |
+
|
| 20 |
+
if resp.status_code == 200:
|
| 21 |
+
try:
|
| 22 |
+
print(f" JSON: {resp.json()}")
|
| 23 |
+
except:
|
| 24 |
+
print(f" Text (first 200 chars): {resp.text[:200]}")
|
| 25 |
+
else:
|
| 26 |
+
print(f" Error text (first 200 chars): {resp.text[:200]}")
|
| 27 |
+
|
| 28 |
+
except requests.exceptions.RequestException as e:
|
| 29 |
+
print(f" Request failed: {e}")
|
| 30 |
+
|
| 31 |
+
# Test the root URL specifically for POST
|
| 32 |
+
print(f"\n🔹 Testing POST to main URL...")
|
| 33 |
+
try:
|
| 34 |
+
resp = requests.post(
|
| 35 |
+
"https://spam-fastapi-cjell.hf.space",
|
| 36 |
+
json={"text": "Hello test"},
|
| 37 |
+
headers={"Content-Type": "application/json"},
|
| 38 |
+
timeout=10
|
| 39 |
+
)
|
| 40 |
+
print(f" POST Status: {resp.status_code}")
|
| 41 |
+
print(f" POST Response: {resp.text[:200]}")
|
| 42 |
+
except requests.exceptions.RequestException as e:
|
| 43 |
+
print(f" POST failed: {e}")
|