DmitrMakeev commited on
Commit
9bf129d
·
verified ·
1 Parent(s): 8083309

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -0
app.py CHANGED
@@ -1542,6 +1542,59 @@ def get_Lo_Mess_senler():
1542
  except Exception as e:
1543
  logging.error(f"An error occurred: {str(e)}")
1544
  return jsonify({"status": "error", "message": str(e)}), 500
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1545
 
1546
 
1547
 
 
1542
  except Exception as e:
1543
  logging.error(f"An error occurred: {str(e)}")
1544
  return jsonify({"status": "error", "message": str(e)}), 500
1545
+
1546
+
1547
+
1548
+
1549
+ # Удаляем пользователя в группу СЕНДЛЕРА
1550
+ @app.route('/del_user_senler', methods=['POST'])
1551
+ def del_user_senler():
1552
+ # Получаем параметры из POST-запроса, если параметр отсутствует, устанавливаем значение пустой строки
1553
+ vk_user_id = request.form.get('vk_user_id', "")
1554
+ subscription_id = request.form.get('sub_id', "")
1555
+
1556
+ # Формируем данные для запроса к API Senler
1557
+ senler_data = {
1558
+ 'vk_user_id': vk_user_id,
1559
+ 'subscription_id': subscription_id,
1560
+ 'v': 2
1561
+ }
1562
+
1563
+ # Отправляем запрос к API Senler
1564
+ response = requests.post('https://senler.ru/api/subscribers/add', data=senler_data)
1565
+
1566
+ # Проверяем успешность запроса
1567
+ success = response.status_code == 200 and response.json().get('success', False)
1568
+
1569
+ # Возвращаем результат
1570
+ return jsonify({
1571
+ 'success': success
1572
+ })
1573
+
1574
+
1575
+
1576
+
1577
+
1578
+
1579
+
1580
+
1581
+
1582
+
1583
+
1584
+
1585
+
1586
+
1587
+
1588
+
1589
+
1590
+
1591
+
1592
+
1593
+
1594
+
1595
+
1596
+
1597
+
1598
 
1599
 
1600