DmitrMakeev
commited on
Commit
•
a471f43
1
Parent(s):
2dc0711
Update app.py
Browse files
app.py
CHANGED
@@ -879,29 +879,18 @@ def update_or_insert_user(db_name, user_data, mapping_template):
|
|
879 |
def send_request():
|
880 |
token = request.form.get('token')
|
881 |
min_date = request.form.get('minDate')
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
'type': webinar_type,
|
889 |
-
'minDate': min_date,
|
890 |
-
'maxDate': max_date,
|
891 |
-
'limit': limit
|
892 |
-
}
|
893 |
-
|
894 |
-
try:
|
895 |
-
response = requests.get(url, headers={'X-Token': token}, params=params)
|
896 |
-
response.raise_for_status() # Проверка на статус ошибки
|
897 |
data = response.json()
|
|
|
|
|
|
|
|
|
898 |
|
899 |
-
# Проверка структуры ответа и извлечение данных
|
900 |
-
webinars = data.get('webinars', [])
|
901 |
-
return jsonify(webinars)
|
902 |
-
|
903 |
-
except requests.exceptions.RequestException as e:
|
904 |
-
return jsonify({'error': f'API request failed: {str(e)}'}), 500
|
905 |
|
906 |
|
907 |
|
|
|
879 |
def send_request():
|
880 |
token = request.form.get('token')
|
881 |
min_date = request.form.get('minDate')
|
882 |
+
type = request.form.get('type')
|
883 |
+
url = f'https://online.bizon365.ru/api/v1/webinars/reports/getlist?minDate={min_date}&type={type}'
|
884 |
+
|
885 |
+
response = requests.get(url, headers={'X-Token': token})
|
886 |
+
|
887 |
+
if response.status_code == 200:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
888 |
data = response.json()
|
889 |
+
webinar_ids = [item['webinarId'] for item in data['list']]
|
890 |
+
return jsonify(webinar_ids)
|
891 |
+
else:
|
892 |
+
return jsonify({'error': 'Failed to fetch data from the API'}), response.status_code
|
893 |
|
|
|
|
|
|
|
|
|
|
|
|
|
894 |
|
895 |
|
896 |
|