Import to project library:
BeautifulSoup3.2.2.zip (22.0 KB)
Test using one of our power monitors:
from BeautifulSoup import BeautifulSoup
url = "http://192.168.140.31/15"
soup = BeautifulSoup(system.net.httpGet(url))
t = soup.find('table')
tr = t.findAll('tr')
headers = ['meter', 'value']
data = []
for row in tr:
td = row.findAll('td')
if len(td) > 0:
data.append([col.text for col in td])
dataOut = system.dataset.toDataSet(headers, data)
Resultant dataset:
row | meter value
---------------------------------
0 | L1 Current 1229
1 | L2 Current 1187
2 | L3 Current 1164
3 | Avg Current 1194
4 | L1-N Voltage 282.0
5 | L2-N Voltage 280.7
6 | L3-N Voltage 277.0
7 | Avg L-N Voltage 279.9
8 | L1-L2 Voltage 487.0
9 | L2-L3 Voltage 482.3
10 | L3-L1 Voltage 485.2
11 | Avg L-L Voltage 484.9
12 | Frequency, last cycle 59.99