def post(self, request, *args, **kwargs): try: client = session_manager.get(request.META['HTTP_SESSION_ID']) except (KeyError, InvalidSessionId): return HttpResponse(status_code=400) session_manager.send_beep(client) return HttpResponse("ok")
def post(self, request, *args, **kwargs): try: client = session_manager.get(request.META['HTTP_SESSION_ID']) except (KeyError, InvalidSessionId): name = names.get_full_name() client = session_manager.create_client(name) return HttpResponse(dumps({"SESSION_ID": client.session_id, "client": client.data})) try: acks = loads(request.body).get("acks") or [] except Exception: raise Exception(request.body) logger.exception(request.body) acks = [] return HttpResponse(dumps({'messages':client.get_messages(acks)}), content_type='application/json')
def post(self, request, *args, **kwargs): try: client = session_manager.get(request.META['HTTP_SESSION_ID']) except (KeyError, InvalidSessionId): name = names.get_full_name() client = session_manager.create_client(name) return HttpResponse( dumps({ "SESSION_ID": client.session_id, "client": client.data })) try: acks = loads(request.body).get("acks") or [] except Exception: raise Exception(request.body) logger.exception(request.body) acks = [] return HttpResponse(dumps({'messages': client.get_messages(acks)}), content_type='application/json')