def handle_sqs_request(request, config): req_msg = RequestMessage.from_AWS_json(request.get_body()) try: handler = get_handler(req_msg, config['routes']) data = handler() error = getattr(handler, 'error', None) send_response(req_msg, data=data, error=error) except HandlerError, e: error_handling_sqs_request(req_msg, exception=e)
def test_from_AWS_json_returns_RequestMessage_object(self): req = RequestMessage.from_AWS_json(self._valid_json) assert type(req) is RequestMessage
def parse_sqs_message(message): return(RequestMessage.from_AWS_json(sqs_msg.get_body()))