Telegram_bot three platform support proxy_url and proxy_params (#12878)

* telegram_bot three platform support proxy_url and proxy_params

* add telegram_bot._initialize_bot to create the bot instance

* rename _initialize_bot to initialize_bot
This commit is contained in:
ruohan.chen authored and Pascal Vizeli committed 2018-03-07 12:44:07 +01:00
1 parent d119610cf1
commit 35bae1eef2
4 files changed
+32 -22

No files matched your search

@@ -13,10 +13,11 @@ from aiohttp.client_exceptions import ClientError
from aiohttp.hdrs import CONNECTION, KEEP_ALIVE
from homeassistant.components.telegram_bot import (
initialize_bot,
CONF_ALLOWED_CHAT_IDS, BaseTelegramBotEntity,
PLATFORM_SCHEMA as TELEGRAM_PLATFORM_SCHEMA)
from homeassistant.const import (
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, CONF_API_KEY)
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP)
from homeassistant.core import callback
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@@ -35,8 +36,7 @@ class WrongHttpStatus(Exception):
@asyncio.coroutine
def async_setup_platform(hass, config):
"""Set up the Telegram polling platform."""
import telegram
bot = telegram.Bot(config[CONF_API_KEY])
bot = initialize_bot(config)
pol = TelegramPoll(bot, hass, config[CONF_ALLOWED_CHAT_IDS])
@callback