Обновить bot-tg.py
This commit is contained in:
parent
81c8a62d72
commit
d996844726
1 changed files with 3 additions and 3 deletions
|
@ -8,7 +8,7 @@ import asyncio
|
|||
|
||||
# настройка логов
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.DEBUG) # Включаем детальное логирование
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
formatter = logging.Formatter(
|
||||
'%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
||||
|
@ -74,7 +74,7 @@ async def get_weather(message: types.Message):
|
|||
logging.info(f"Запрос погоды для: {city} (от {message.from_user.id})")
|
||||
|
||||
try:
|
||||
# Запрос к API
|
||||
# запрос к API
|
||||
url = f"https://api.openweathermap.org/data/2.5/weather?q={city}&appid={WEATHER_API_KEY}&units=metric&lang=ru"
|
||||
response = requests.get(url, timeout=10)
|
||||
|
||||
|
@ -88,7 +88,7 @@ async def get_weather(message: types.Message):
|
|||
|
||||
data = response.json()
|
||||
|
||||
# Формирование ответа
|
||||
# формирование ответа
|
||||
weather_report = (
|
||||
f"Город: {data['name']}\n"
|
||||
f"Температура: {data['main']['temp']:.1f}°C\n"
|
||||
|
|
Loading…
Add table
Reference in a new issue