29 lines
663 B
Python
29 lines
663 B
Python
|
|
import requests
|
|
import json
|
|
|
|
URL = "http://localhost:8000/api/segments/save_custom"
|
|
|
|
def test_save_custom():
|
|
payload = {
|
|
"name": "Test Segment Discovered",
|
|
"description": "Created via API test",
|
|
"activity_type": "cycling",
|
|
"points": [
|
|
[151.2093, -33.8688, 10],
|
|
[151.2100, -33.8690, 15],
|
|
[151.2110, -33.8700, 20]
|
|
]
|
|
}
|
|
|
|
try:
|
|
res = requests.post(URL, json=payload)
|
|
print(f"Status: {res.status_code}")
|
|
print(f"Response: {res.text}")
|
|
|
|
except Exception as e:
|
|
print(f"Error: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
test_save_custom()
|