crk_telegram_bot/debug.py

53 lines
1.6 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import platform
import sys
from datetime import datetime
import os
import pytz
import aiogram
def get_debug_info():
try:
# Системная информация
system_name = platform.system()
system_version = platform.version()
system_release = platform.release()
# Версия Python
python_version = sys.version
# Версия aiogram
aiogram_version = aiogram.__version__
# Локация сервера
server_location = os.getenv('SERVER_LOCATION', 'Неизвестно')
# Время сервера
server_time = datetime.now(pytz.utc).strftime('%Y-%m-%d %H:%M:%S UTC')
# Информация о процессоре
processor_info = platform.processor()
# Информация о машине
machine_info = platform.machine()
# Возвращаем массив с данными
return {
"System Name": system_name,
"System Version": system_version,
"System Release": system_release,
"Python Version": python_version,
"Aiogram Version": aiogram_version,
"Server Location": server_location,
"Server Time": server_time,
"Processor Info": processor_info,
"Machine Info": machine_info,
}
except Exception as e:
return {"Error": str(e)}
if __name__ == "__main__":
# Для отладки: вывод информации
debug_info = get_debug_info()
for key, value in debug_info.items():
print(f"{key}: {value}")