add logging

This commit is contained in:
Administrator 2023-10-11 19:13:00 +03:00
parent 86738de9ac
commit f38c57b3ac

View File

@ -1,3 +1,4 @@
import logging
import os
import telebot
@ -15,7 +16,7 @@ STAFF_CACHE = TTLCache(100, 60)
def is_staff(telegram_id):
print('there')
logging.info("is staff check")
staff_data = STAFF_CACHE.get(telegram_id)
if staff_data is None:
staff_data = get(
@ -26,8 +27,10 @@ def is_staff(telegram_id):
}
)
if staff_data.status_code != 200:
logging.info('return status ' + str(staff_data.status_code))
return False
staff_data = staff_data.json()['is_staff']
logging.info('got info ' + str(staff_data))
STAFF_CACHE[telegram_id] = staff_data
return staff_data