DmitrMakeev commited on
Commit
a6ba269
·
verified ·
1 Parent(s): 9c21ebf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -17
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
- min_date = request.form.get('minDate')
882
- max_date = request.form.get('maxDate')
883
- limit = request.form.get('limit', '20') # Значение по умолчанию
884
- type = request.form.get('type', 'LiveWebinars') # Значение по умолчанию
885
-
886
- url = 'https://online.bizon365.ru/api/v1/webinars/reports/getlist'
887
- params = {
888
- 'minDate': min_date,
889
- 'maxDate': max_date,
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
- webinar_ids = [item['webinarId'] for item in data['list']]
899
- return jsonify(webinar_ids)
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