| 12345678910111213141516171819202122232425262728293031323334353637 |
- from MicroWebSrv.microWebSrv import MicroWebSrv
- from module import mod
- @MicroWebSrv.route('/status')
- def _httpHandlerStatusGet(httpClient, httpResponse) :
- content = mod.get_dat()
- print("content:", content)
- httpResponse.WriteResponseOk( headers = None,
- contentType = "text/html",
- contentCharset = "UTF-8",
- content = content )
- @MicroWebSrv.route('/heat/<index>')
- def _httpHandlerHeat(httpClient, httpResponse, args={}) :
- content = ''
- if 'index' in args:
- if args['index'] == 'on':
- mod.heat_on()
- content = str(mod.heat.status)
- elif args['index'] == 'off':
- mod.heat_off()
- content = str(mod.heat.status)
- elif args['index'] == 'status':
- content = str(mod.heat.status)
- print('_httpHandlerHeat:', content)
- httpResponse.WriteResponseOk( headers = None,
- contentType = "text/html",
- contentCharset = "UTF-8",
- content = content )
- # ----------------------------------------------------------------------------
- routeHandlers = [
- ( "/status", "GET", _httpHandlerStatusGet ),
- ( '/heat/<index>', 'GET', _httpHandlerHeat ),
- ]
|