Move imports in telegram_bot component (#27785)

This commit is contained in:
Quentame 2019-10-18 02:19:34 +02:00 committed by Paulus Schoutsen
parent 2d1f7932ba
commit bd0403c65e
3 changed files with 18 additions and 16 deletions

View file

@ -2,6 +2,8 @@
import datetime as dt
import logging
from telegram.error import TimedOut
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.http.const import KEY_REAL_IP
from homeassistant.const import (
@ -26,7 +28,6 @@ REMOVE_HANDLER_URL = ""
async def async_setup_platform(hass, config):
"""Set up the Telegram webhooks platform."""
import telegram
bot = initialize_bot(config)
@ -55,7 +56,7 @@ async def async_setup_platform(hass, config):
while retry_num < 3:
try:
return bot.setWebhook(handler_url, timeout=5)
except telegram.error.TimedOut:
except TimedOut:
retry_num += 1
_LOGGER.warning("Timeout trying to set webhook (retry #%d)", retry_num)