forked from Atharva-Mendhulkar/CAPS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_api.py
More file actions
31 lines (25 loc) · 778 Bytes
/
Copy pathverify_api.py
File metadata and controls
31 lines (25 loc) · 778 Bytes
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
28
29
30
31
import requests
import sys
def test_api():
url = "http://localhost:8000/process-command"
payload = {
"text": "pay shop@upi 100",
"user_id": "test_user_1"
}
try:
print(f"Sending request to {url}...")
response = requests.post(url, json=payload)
response.raise_for_status()
data = response.json()
print("Response:", data)
if data["status"] == "processed":
print("✅ API Verification Passed")
sys.exit(0)
else:
print("❌ API returned unexpected status")
sys.exit(1)
except Exception as e:
print(f"❌ API Verification Failed: {e}")
sys.exit(1)
if __name__ == "__main__":
test_api()