DmitrMakeev
commited on
Commit
•
fdf506b
1
Parent(s):
6b23076
Update app.py
Browse files
app.py
CHANGED
@@ -765,20 +765,7 @@ def data_gc_tab_out():
|
|
765 |
|
766 |
|
767 |
|
768 |
-
|
769 |
-
def send_request():
|
770 |
-
token = request.form.get('token')
|
771 |
-
min_date = request.form.get('minDate')
|
772 |
-
url = f'https://online.bizon365.ru/api/v1/webinars/reports/getlist?minDate={min_date}'
|
773 |
-
|
774 |
-
response = requests.get(url, headers={'X-Token': token})
|
775 |
-
|
776 |
-
if response.status_code == 200:
|
777 |
-
data = response.json()
|
778 |
-
webinar_ids = [item['webinarId'] for item in data['list']]
|
779 |
-
return jsonify(webinar_ids)
|
780 |
-
else:
|
781 |
-
return jsonify({'error': 'Failed to fetch data from the API'}), response.status_code
|
782 |
|
783 |
|
784 |
|
@@ -888,6 +875,30 @@ def update_or_insert_user(db_name, user_data, mapping_template):
|
|
888 |
conn.close()
|
889 |
logging.debug(f"User with email {email} processed successfully")
|
890 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
891 |
|
892 |
|
893 |
@app.route('/send_get_request', methods=['GET'])
|
|
|
765 |
|
766 |
|
767 |
|
768 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
|
770 |
|
771 |
|
|
|
875 |
conn.close()
|
876 |
logging.debug(f"User with email {email} processed successfully")
|
877 |
|
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 |
|
903 |
|
904 |
@app.route('/send_get_request', methods=['GET'])
|