Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1502,7 +1502,8 @@ def get_Lo_Mess_senler():
|
|
1502 |
"Authorization": f"Bearer {senler_token}"
|
1503 |
}
|
1504 |
payload = {
|
1505 |
-
"vk_user_id": [vk_user_id]
|
|
|
1506 |
}
|
1507 |
|
1508 |
# Выполняем запрос к API Senler
|
@@ -1516,23 +1517,11 @@ def get_Lo_Mess_senler():
|
|
1516 |
# Парсим ответ
|
1517 |
data = response.json()
|
1518 |
|
1519 |
-
#
|
1520 |
-
|
1521 |
-
logging.error(f"Senler API request failed: {data.get('error', {}).get('message', 'Unknown error')}")
|
1522 |
-
return jsonify({"status": "error", "message": "Senler API request failed"}), 500
|
1523 |
|
1524 |
-
#
|
1525 |
-
|
1526 |
-
return jsonify({"status": "not"}), 200
|
1527 |
-
|
1528 |
-
# Проверяем, есть ли указанная группа в массиве subscriptions
|
1529 |
-
for subscriber in data["items"]:
|
1530 |
-
for subscription in subscriber.get("subscriptions", []):
|
1531 |
-
if subscription.get("subscription_id") == int(subscription_id):
|
1532 |
-
return jsonify({"status": "1"}), 200
|
1533 |
-
|
1534 |
-
# Если группа не найдена
|
1535 |
-
return jsonify({"status": "not"}), 200
|
1536 |
|
1537 |
except Exception as e:
|
1538 |
logging.error(f"An error occurred: {str(e)}")
|
|
|
1502 |
"Authorization": f"Bearer {senler_token}"
|
1503 |
}
|
1504 |
payload = {
|
1505 |
+
"vk_user_id": [vk_user_id],
|
1506 |
+
"count": 100
|
1507 |
}
|
1508 |
|
1509 |
# Выполняем запрос к API Senler
|
|
|
1517 |
# Парсим ответ
|
1518 |
data = response.json()
|
1519 |
|
1520 |
+
# Выводим полный ответ от сервера Senler в консоль
|
1521 |
+
logging.debug(f"Senler API response: {data}")
|
|
|
|
|
1522 |
|
1523 |
+
# Возвращаем успешный ответ
|
1524 |
+
return jsonify({"status": "success", "message": "Request completed", "data": data}), 200
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1525 |
|
1526 |
except Exception as e:
|
1527 |
logging.error(f"An error occurred: {str(e)}")
|