DmitrMakeev
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -766,11 +766,7 @@ def send_get_request():
|
|
766 |
|
767 |
if response.status_code == 200:
|
768 |
data = response.json()
|
769 |
-
|
770 |
-
# Извлечение необходимых данных
|
771 |
-
room_title = data.get('room_title', 'No Title')
|
772 |
-
|
773 |
-
# Извлечение данных отчета
|
774 |
report = data.get('report', {})
|
775 |
|
776 |
# Извлечение полей из отчета
|
@@ -781,22 +777,30 @@ def send_get_request():
|
|
781 |
try:
|
782 |
report_json = json.loads(report_json_str)
|
783 |
except json.JSONDecodeError:
|
784 |
-
report_json = {}
|
|
|
|
|
785 |
|
786 |
-
# Извлечение
|
787 |
-
|
|
|
788 |
|
|
|
|
|
|
|
|
|
|
|
789 |
# Возврат результата
|
790 |
result = {
|
791 |
|
792 |
'report': report_json,
|
|
|
793 |
|
794 |
}
|
795 |
|
796 |
return jsonify(result)
|
797 |
else:
|
798 |
return jsonify({'error': 'Failed to fetch data from the API'}), response.status_code
|
799 |
-
|
800 |
|
801 |
|
802 |
|
|
|
766 |
|
767 |
if response.status_code == 200:
|
768 |
data = response.json()
|
769 |
+
# Извлечение данных отчета
|
|
|
|
|
|
|
|
|
770 |
report = data.get('report', {})
|
771 |
|
772 |
# Извлечение полей из отчета
|
|
|
777 |
try:
|
778 |
report_json = json.loads(report_json_str)
|
779 |
except json.JSONDecodeError:
|
780 |
+
report_json = {}
|
781 |
+
# Извлечение данных отчета
|
782 |
+
messages = data.get('messages', {})
|
783 |
|
784 |
+
# Извлечение полей из отчета
|
785 |
+
|
786 |
+
messages_json_str = report.get('messages', '{}')
|
787 |
|
788 |
+
# Обработка строкового JSON в report
|
789 |
+
try:
|
790 |
+
messages_json = json.loads(messages_json_str)
|
791 |
+
except json.JSONDecodeError:
|
792 |
+
messages_json = {}
|
793 |
# Возврат результата
|
794 |
result = {
|
795 |
|
796 |
'report': report_json,
|
797 |
+
'messages': messages_json
|
798 |
|
799 |
}
|
800 |
|
801 |
return jsonify(result)
|
802 |
else:
|
803 |
return jsonify({'error': 'Failed to fetch data from the API'}), response.status_code
|
|
|
804 |
|
805 |
|
806 |
|