S7_snap7_Stremer_n_Recorder/test_endpoint.py

24 lines
722 B
Python

import requests
import json
# Test the symbols load endpoint
url = "http://localhost:5050/api/symbols/load"
data = {
"asc_file_path": "D:/Proyectos/Scripts/Siemens/S7_snap7_Stremer_n_Log/config/data/test_symbols.asc"
}
try:
response = requests.post(url, json=data)
print(f"Status Code: {response.status_code}")
print(f"Response Headers: {response.headers}")
print(f"Response Text: {response.text}")
if response.headers.get("content-type", "").startswith("application/json"):
result = response.json()
print(f"JSON Response: {json.dumps(result, indent=2)}")
else:
print("Response is not JSON, probably HTML error page")
except Exception as e:
print(f"Error: {e}")