Update app.py
Browse files
app.py
CHANGED
@@ -766,10 +766,38 @@ def send_get_request():
|
|
766 |
|
767 |
if response.status_code == 200:
|
768 |
data = response.json()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
|
770 |
-
# Извлечение
|
771 |
custom_fields = data.get('customFields', {})
|
772 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
773 |
else:
|
774 |
return jsonify({'error': 'Failed to fetch data from the API'}), response.status_code
|
775 |
|
|
|
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 |
+
# Извлечение полей из отчета
|
777 |
+
webinar_id = report.get('webinarId', '')
|
778 |
+
group = report.get('group', '')
|
779 |
+
roomid = report.get('roomid', '')
|
780 |
+
created = report.get('created', '')
|
781 |
+
play_from_room = report.get('playFromRoom', '')
|
782 |
+
report_json_str = report.get('report', '{}')
|
783 |
+
|
784 |
+
# Обработка строкового JSON в report
|
785 |
+
try:
|
786 |
+
report_json = json.loads(report_json_str)
|
787 |
+
except json.JSONDecodeError:
|
788 |
+
report_json = {}
|
789 |
|
790 |
+
# Извлечение customFields
|
791 |
custom_fields = data.get('customFields', {})
|
792 |
+
|
793 |
+
# Возврат результата
|
794 |
+
result = {
|
795 |
+
|
796 |
+
'report': report_json,
|
797 |
+
|
798 |
+
}
|
799 |
+
|
800 |
+
return jsonify(result)
|
801 |
else:
|
802 |
return jsonify({'error': 'Failed to fetch data from the API'}), response.status_code
|
803 |
|