24 lines
787 B
Python
24 lines
787 B
Python
from bs4 import BeautifulSoup
|
|
import requests
|
|
|
|
def getFromWhiteBoardServer(key):
|
|
"""
|
|
Go in and read/write the value from a key from the whiteboard. The value
|
|
should use decimal dot, not comma!
|
|
"""
|
|
|
|
url = 'http://whiteboard.syslab.dk/wbget.php?mode=html'
|
|
r = requests.get(url, auth=requests.auth.HTTPBasicAuth('twinPV99', 'twinPV99'))
|
|
data = r.text
|
|
print(data)
|
|
soup = BeautifulSoup(data)
|
|
table = soup.find('table')
|
|
key = table.find('td', text=key)
|
|
value = key.findNext('td')
|
|
return value.text
|
|
|
|
|
|
def publishToWhiteBoardServer(key, value):
|
|
url = 'http://whiteboard.syslab.dk/wbset.php?source=SYSLAB&' + key + '=' + str(value)
|
|
r = requests.post(url, auth=requests.auth.HTTPBasicAuth('twinPV99', 'twinPV99'))
|