diff --git a/examples/echo_bot.py b/examples/echo_bot.py index ac789ad6..fc0bb0ff 100644 --- a/examples/echo_bot.py +++ b/examples/echo_bot.py @@ -1,6 +1,7 @@ import asyncio import logging import sys +from os import getenv from aiogram import Bot, Dispatcher, Router, types from aiogram.enums import ParseMode @@ -9,9 +10,7 @@ from aiogram.types import Message from aiogram.utils.markdown import hbold # Bot token can be obtained via https://t.me/BotFather -TOKEN = "42:TOKEN" -# However, is recommended to get the token from environment variable: -# TOKEN = getenv("BOT_TOKEN") +TOKEN = getenv("BOT_TOKEN") # All handlers should be attached to the Router (or Dispatcher) router = Router() diff --git a/examples/echo_bot_webhook.py b/examples/echo_bot_webhook.py index b8632384..4d6f54e8 100644 --- a/examples/echo_bot_webhook.py +++ b/examples/echo_bot_webhook.py @@ -3,6 +3,7 @@ This example shows how to use webhook on behind of any reverse proxy (nginx, tra """ import logging import sys +from os import getenv from aiohttp import web @@ -14,9 +15,7 @@ from aiogram.utils.markdown import hbold from aiogram.webhook.aiohttp_server import SimpleRequestHandler, setup_application # Bot token can be obtained via https://t.me/BotFather -TOKEN = "42:TOKEN" -# However, is recommended to get the token from environment variable: -# TOKEN = getenv("BOT_TOKEN") +TOKEN = getenv("BOT_TOKEN") # Webserver settings diff --git a/examples/echo_bot_webhook_ssl.py b/examples/echo_bot_webhook_ssl.py index 83aff5c6..adc11dd9 100644 --- a/examples/echo_bot_webhook_ssl.py +++ b/examples/echo_bot_webhook_ssl.py @@ -3,6 +3,7 @@ This example shows how to use webhook with SSL certificate. """ import logging import ssl +from os import getenv from aiohttp import web @@ -14,9 +15,7 @@ from aiogram.utils.markdown import hbold from aiogram.webhook.aiohttp_server import SimpleRequestHandler, setup_application # Bot token can be obtained via https://t.me/BotFather -TOKEN = "42:TOKEN" -# However, is recommended to get the token from environment variable: -# TOKEN = getenv("BOT_TOKEN") +TOKEN = getenv("BOT_TOKEN") # Webserver settings diff --git a/examples/finite_state_machine.py b/examples/finite_state_machine.py index 1aaa59ab..f62f2665 100644 --- a/examples/finite_state_machine.py +++ b/examples/finite_state_machine.py @@ -16,9 +16,7 @@ from aiogram.types import ( ReplyKeyboardRemove, ) -TOKEN = "42:TOKEN" -# However, is recommended to get the token from environment variable: -# TOKEN = getenv("BOT_TOKEN") +TOKEN = getenv("BOT_TOKEN") form_router = Router() diff --git a/examples/multibot.py b/examples/multibot.py index 9f9c0523..61210f22 100644 --- a/examples/multibot.py +++ b/examples/multibot.py @@ -21,9 +21,7 @@ from aiogram.webhook.aiohttp_server import ( main_router = Router() BASE_URL = getenv("BASE_URL", "https://example.com") -MAIN_BOT_TOKEN = "42:TOKEN" -# However, is recommended to get the token from environment variable: -# MAIN_BOT_TOKEN = getenv("BOT_TOKEN") +MAIN_BOT_TOKEN = getenv("BOT_TOKEN") WEB_SERVER_HOST = "127.0.0.1" diff --git a/examples/specify_updates.py b/examples/specify_updates.py index 3f10f02a..103f6b27 100644 --- a/examples/specify_updates.py +++ b/examples/specify_updates.py @@ -1,6 +1,7 @@ import asyncio import logging import sys +from os import getenv from aiogram import Bot, Dispatcher, Router from aiogram.enums import ParseMode @@ -14,9 +15,7 @@ from aiogram.types import ( ) from aiogram.utils.markdown import hbold, hcode -TOKEN = "42:TOKEN" -# However, is recommended to get the token from environment variable: -# TOKEN = getenv("BOT_TOKEN") +TOKEN = getenv("BOT_TOKEN") logger = logging.getLogger(__name__) diff --git a/examples/web_app/main.py b/examples/web_app/main.py index 96e1f5c1..db148153 100644 --- a/examples/web_app/main.py +++ b/examples/web_app/main.py @@ -11,9 +11,7 @@ from aiogram import Bot, Dispatcher from aiogram.types import MenuButtonWebApp, WebAppInfo from aiogram.webhook.aiohttp_server import SimpleRequestHandler, setup_application -TOKEN = "42:TOKEN" -# However, is recommended to get the token from environment variable: -# TOKEN = getenv("BOT_TOKEN") +TOKEN = getenv("BOT_TOKEN") APP_BASE_URL = getenv("APP_BASE_URL")