-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_api.py
More file actions
31 lines (26 loc) · 952 Bytes
/
Copy pathtest_api.py
File metadata and controls
31 lines (26 loc) · 952 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 json
url = "http://127.0.0.1:5000/api/calculate"
data = {
"name": "John Doe",
"city": "Delhi",
"country": "India",
"dwellers": 5,
"roof_area": 120.0,
"open_space": 50.0,
"year": 2026
}
print("Testing endpoint:", url)
print("Request data:", json.dumps(data, indent=2))
print("\nSending request...")
response = requests.post(url, json=data)
print(f"Status code: {response.status_code}")
print(f"Response: {json.dumps(response.json(), indent=2)}")
if response.status_code == 200:
result = response.json()
print("\n SUCCESS! Key predictions:")
print(f" - Feasibility: {result.get('feasibility')}")
print(f" - Harvestable: {result.get('harvestable_volume')} L/year")
print(f" - Annual Demand: {result.get('annual_demand')} L/year")
print(f" - Payback Period: {result.get('payback_period_years')} years")
print(f" - 20-Year ROI: {result.get('roi_percent_20_years')}%")