From ac0d3058d7422e5f1d209b6fe7ed3f5dbf02029f Mon Sep 17 00:00:00 2001 From: FrederikBaerentsen Date: Thu, 29 Feb 2024 02:43:31 -0500 Subject: [PATCH] Working on missing parts --- app.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/app.py b/app.py index 8a4968f..b52bb9e 100644 --- a/app.py +++ b/app.py @@ -35,22 +35,17 @@ def save_number(): json_file = json.loads(info.read()) print(json_file['count']) - data = ''' - { - "brick" : { - "ID": ''' + data1 + ''', - "color_name": ''' + data2 + ''', - "amount":''' + number + ''' - } - } - ''' - json_file['unit'][0]['bricks']['missing'].append(data) + data = '{"brick" : {"ID":"' + data1 + '","color_name": "' + data2 + '","amount":"' + number + '"}}' + print(data) + print(json.loads(data)) + json_file['unit'][0]['bricks']['missing'].append(json.loads(data)) + print(json_file['unit'][0]['bricks']) # Save number to JSON file - with open('data.json', 'w') as json_file: - json.dump(json_file, json_file) + with open('./info/'+tmp+'.json', 'w') as dump_file: + json.dump(json_file,dump_file) return ('', 204) if __name__ == '__main__': - app.run(host='23.88.46.240', debug=True, port=3333) + app.run(host='192.168.10.109', debug=True, port=3333)