DmitrMakeev commited on
Commit
9ba7b32
1 Parent(s): 4af33dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import flask
2
  from flask import request, jsonify
 
3
  import os
4
  import json
5
  from dotenv import load_dotenv
@@ -26,8 +27,11 @@ def avp():
26
  result[key] = str(int(value) - 1)
27
  else:
28
  result[key] = value
29
- response = jsonify(result)
30
- return response
 
 
 
31
  except Exception as e:
32
  error_response = {
33
  "error": str(e)
 
1
  import flask
2
  from flask import request, jsonify
3
+ from flask import send_file
4
  import os
5
  import json
6
  from dotenv import load_dotenv
 
27
  result[key] = str(int(value) - 1)
28
  else:
29
  result[key] = value
30
+ # Сохранение результата в файл
31
+ with open("output.json", "w") as file:
32
+ json.dump(result, file)
33
+ # Возвращение файла клиенту
34
+ return send_file("output.json", as_attachment=True)
35
  except Exception as e:
36
  error_response = {
37
  "error": str(e)