def login(table): table = "{0}_{1}".format(table, "dev") dynamo = DynamoDB(table) print('###### Request: ######', request.get_json()) if request.is_json: data = request.get_json() id = data['id'] user = {'id': id} password = data['password'] response = dynamo.select(user) # print("response app_dev.py", response) # print("response app_dev.py", response[0]) if 'id' in response[0]['response'] and response[0]['response'][ 'id'] == id and response[0]['response']['password'] == password: return jsonify(response) return jsonify({'id': None, 'password': None}) else: return jsonify({ 'message': 'Request was not JSON', 'response': {} }), 500
def select(table): dynamo = DynamoDB(table) print('###### Request: ######', request.get_json()) if request.is_json: data = request.get_json() print(data) response = dynamo.select(data) return json.dumps(response, default=decimal_default) else: return jsonify({ 'message': 'Request was not JSON', 'response': None }), 500