picoweb URL Params in routes
Posted: Sun Oct 15, 2017 5:55 am
Hi;
I am unable to successfully define a regex to handle url GET parameters such ads:
I have attempted to look for the path starting with "/?" - what am I doing wrong ??
I am unable to successfully define a regex to handle url GET parameters such ads:
Code: Select all
http://mydevice/?x=1&y=2&z=3
Code: Select all
def json(req,resp):
yield from picoweb.jsonify(resp,{"error":True})
ROUTES = [
(re.compile("^/\?.*"), json),
("/", lambda req, resp: (yield from app.sendfile(resp, path+"index.htm"))),
(re.compile("^/(.+)"), lambda req, resp: (yield from app.sendfile(resp, path + req.url_match.group(1)))),
]