DmitrMakeev
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -878,25 +878,19 @@ def update_or_insert_user(db_name, user_data, mapping_template):
|
|
878 |
@app.route('/send_request', methods=['POST'])
|
879 |
def send_request():
|
880 |
token = request.form.get('token')
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
url = 'https://online.bizon365.ru/api/v1/webinars
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
'limit': limit,
|
891 |
-
'type': type
|
892 |
-
}
|
893 |
-
|
894 |
-
response = requests.get(url, headers={'X-Token': token}, params=params)
|
895 |
-
|
896 |
if response.status_code == 200:
|
897 |
data = response.json()
|
898 |
-
|
899 |
-
return jsonify(
|
900 |
else:
|
901 |
return jsonify({'error': 'Failed to fetch data from the API'}), response.status_code
|
902 |
|
|
|
878 |
@app.route('/send_request', methods=['POST'])
|
879 |
def send_request():
|
880 |
token = request.form.get('token')
|
881 |
+
minDate = request.form.get('minDate')
|
882 |
+
limit = int(request.form.get('limit', 20)) # Значение по умолчанию = 20
|
883 |
+
type = request.form.get('type', 'LiveWebinars')
|
884 |
+
|
885 |
+
# Пример URL с учетом параметров запроса
|
886 |
+
url = f'https://online.bizon365.ru/api/v1/webinars?limit={limit}&type={type}&minDate={minDate}'
|
887 |
+
|
888 |
+
response = requests.get(url, headers={'X-Token': token})
|
889 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
890 |
if response.status_code == 200:
|
891 |
data = response.json()
|
892 |
+
# Здесь обработка данных и возврат ответа
|
893 |
+
return jsonify(data)
|
894 |
else:
|
895 |
return jsonify({'error': 'Failed to fetch data from the API'}), response.status_code
|
896 |
|