49 lines
1.6 KiB
Python
49 lines
1.6 KiB
Python
import requests
|
|
import json
|
|
|
|
try:
|
|
response = requests.get("http://localhost:5050/api/symbols")
|
|
data = response.json()
|
|
|
|
if data.get("success"):
|
|
symbols = data.get("symbols", [])
|
|
print(f"Total symbols loaded: {len(symbols)}")
|
|
|
|
# Search for the specific symbol
|
|
target_symbol = "AUX Blink_2.0S"
|
|
found = False
|
|
|
|
print(f'\nSearching for: "{target_symbol}"')
|
|
for symbol in symbols:
|
|
if target_symbol.lower() in symbol.get("name", "").lower():
|
|
print(
|
|
f'Found similar: "{symbol["name"]}" -> {symbol.get("plc_address", "N/A")}'
|
|
)
|
|
found = True
|
|
|
|
# Also search for variations
|
|
variations = ["AUX Blink", "Blink_2.0S", "AUX", "Blink"]
|
|
for variation in variations:
|
|
for symbol in symbols:
|
|
if variation.lower() in symbol.get("name", "").lower():
|
|
print(
|
|
f'Found variation "{variation}": "{symbol["name"]}" -> {symbol.get("plc_address", "N/A")}'
|
|
)
|
|
found = True
|
|
break
|
|
|
|
if not found:
|
|
print(f'Symbol "{target_symbol}" not found')
|
|
|
|
# Show first few symbols as sample
|
|
print("\nFirst 10 symbols in table:")
|
|
for i, symbol in enumerate(symbols[:10]):
|
|
print(
|
|
f' {i+1}. "{symbol.get("name", "N/A")}" -> {symbol.get("plc_address", "N/A")}'
|
|
)
|
|
else:
|
|
print("Failed to load symbols:", data.get("error", "Unknown error"))
|
|
|
|
except Exception as e:
|
|
print(f"Error: {e}")
|