def POST(self, **kwargs):
lowstate = cherrypy.request.lowstate
username = "-"
if isinstance(lowstate, list) and lowstate:
first = lowstate[0]
username = first.get("username") or (first.get("kwarg", {}).get("username") if "kwarg" in first else None)
# Store username in request so CherryPy's access logger can use it
# We need to override the logging format globally, so this is not enough by itself.
# Use Option 1 or 2 above for the full solution.
return {"return": list(self.exec_lowstate())}