Exemple #1
0
 def style(req, resp):
     yield from picoweb.start_response(resp, content_type = "text/javascript")
     
     htmlFile = open('site/code.js', 'r')
 
     for line in htmlFile:
         yield from resp.awrite(line)
Exemple #2
0
 def style(req, resp):
     yield from picoweb.start_response(resp, content_type = "text/css")
     
     htmlFile = open('site/style.css', 'r')
 
     for line in htmlFile:
         yield from resp.awrite(line)
Exemple #3
0
 def index(req, resp):
     yield from picoweb.start_response(resp, content_type = "text/html")
 
     htmlFile = open('site/site.html', 'r')
 
     for line in htmlFile:
         yield from resp.awrite(line)
Exemple #4
0
 def api(req, resp):
     yield from picoweb.start_response(resp, content_type = "text/html")
     
     proc = req.qs.split("&")
     for elm in proc:
         temp = elm.split("=")
         try:
             self.outDict[temp[0]] = int(temp[1])
         except:
             self.outDict[temp[0]] = temp[1]
     self.newData = True
 def apiGetSysinf(req, resp):
     jsonData = {
         "battery": {
             "voltage": self.brick.battery.voltage(),
             "current": self.brick.battery.current()
         }
     }
     encoded = ujson.dumps(jsonData)
     yield from picoweb.start_response(resp,
                                       content_type="application/json")
     yield from resp.awrite(encoded)
Exemple #6
0
def index(req, resp):
    yield from picoweb.start_response(resp)
    yield from app.render_template(resp, "page.html")
    gc.collect()