def flask_post(path): try: init() flask.request.get_data() data = flask.request.data try : event = json.loads(data) except: return ('bad POST data: "%s"'%str(data), 400) return json.dumps(lambda_func.handler(db_conn, event)) except Exception: return (traceback.format_exc(), 500) # internal error
def post(self): try: data = self.request.body try: event = json.loads(data) except: self.set_status(400) self.write('bad POST data: "%s"' % str(data)) return self.write(json.dumps(lambda_func.handler(db_conn, event))) except Exception: self.set_status(500) # internal error self.write(traceback.format_exc())
def post(self): try: data = self.request.body try : event = json.loads(data) except: self.set_status(400) self.write('bad POST data: "%s"'%str(data)) return self.write(json.dumps(lambda_func.handler(event))) except Exception: self.set_status(500) # internal error self.write(traceback.format_exc())
def make_request(data): print (data.get("operation")) print (json.dumps(data, indent=4)) print ('\n') response = handler(data, None) print (json.dumps(response, indent=4))