def get(self, agent_id): username = self.get_current_user() customer_name = get_current_customer_name(username) uri = self.request.uri method = self.request.method try: agent_queue = '[]' rqueue = QueueWorker({'agent_id': agent_id}, username) queue_exists = rqueue.exists() agent_queue = (process_queue_data(rqueue, queue_exists, agent_id, username, customer_name, uri, method)) status = (AgentResults(username, uri, method).check_in(agent_id, agent_queue)) logger.info(status) update_agent_status(agent_id, username, self.request.uri, self.request.method) self.set_status(status['http_status']) self.set_header('Content-Type', 'application/json') self.write(dumps(status)) except Exception as e: status = (GenericResults(username, uri, method).something_broke( agent_id, 'check_in', e)) logger.exception(e) self.set_status(status['http_status']) self.set_header('Content-Type', 'application/json') self.write(dumps(status))
def get_agent_queue(agent_id): if agent_id is None: return dumps([]) rqueue = QueueWorker({'agent_id': agent_id}) agent_queue = process_queue_data(rqueue, rqueue.exists()) return agent_queue
def get_agent_queue(agent_id): if agent_id is None: return dumps([]) rqueue = QueueWorker({'agent_id': agent_id}) agent_queue = process_queue_data( rqueue, rqueue.exists() ) return agent_queue
def get(self, agent_id): username = self.get_current_user() customer_name = get_current_customer_name(username) uri = self.request.uri method = self.request.method try: agent_queue = '[]' rqueue = QueueWorker({'agent_id': agent_id}, username) queue_exists = rqueue.exists() agent_queue = ( process_queue_data( rqueue, queue_exists, agent_id, username, customer_name, uri, method ) ) status = ( AgentResults( username, uri, method ).check_in(agent_id, agent_queue) ) logger.info(status) update_agent_status( agent_id, username, self.request.uri, self.request.method ) self.set_status(status['http_status']) self.set_header('Content-Type', 'application/json') self.write(dumps(status)) except Exception as e: status = ( GenericResults( username, uri, method ).something_broke(agent_id, 'check_in', e) ) logger.exception(e) self.set_status(status['http_status']) self.set_header('Content-Type', 'application/json') self.write(dumps(status))