Move imports in telegram_bot component (#27785)

This commit is contained in:
Quentame authored and Paulus Schoutsen committed 2019-10-17 17:19:34 -07:00
1 parent 2d1f7932ba
commit bd0403c65e
3 files changed
+18 -16

No files matched your search

@@ -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)