Update app.py
Browse files
app.py
CHANGED
|
@@ -766,20 +766,7 @@ def send_get_request():
|
|
| 766 |
|
| 767 |
if response.status_code == 200:
|
| 768 |
data = response.json()
|
| 769 |
-
|
| 770 |
-
# JavaScript код для извлечения поля "report"
|
| 771 |
-
js_code = f"""
|
| 772 |
-
function getReport(data) {{
|
| 773 |
-
return data.report;
|
| 774 |
-
}}
|
| 775 |
-
"""
|
| 776 |
-
|
| 777 |
-
# Компиляция JavaScript кода
|
| 778 |
-
ctx = execjs.compile(js_code)
|
| 779 |
-
|
| 780 |
-
# Вызов функции JavaScript для извлечения поля "report"
|
| 781 |
-
report = ctx.call("getReport", data)
|
| 782 |
-
|
| 783 |
return jsonify(report)
|
| 784 |
else:
|
| 785 |
return jsonify({'error': 'Failed to fetch data from the API'}), response.status_code
|
|
|
|
| 766 |
|
| 767 |
if response.status_code == 200:
|
| 768 |
data = response.json()
|
| 769 |
+
report = data.get('report', {})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 770 |
return jsonify(report)
|
| 771 |
else:
|
| 772 |
return jsonify({'error': 'Failed to fetch data from the API'}), response.status_code
|