# Buggy code
def __init__(
    self,
    token: base.String,
    loop: Optional[Union[asyncio.BaseEventLoop, asyncio.AbstractEventLoop]] = None,
    connections_limit: Optional[base.Integer] = None,
    proxy: Optional[base.String] = None,
    proxy_auth: Optional[aiohttp.BasicAuth] = None,
    validate_token: Optional[base.Boolean] = True,
    parse_mode: typing.Optional[base.String] = None,
    timeout: typing.Optional[
        typing.Union[base.Integer, base.Float, aiohttp.ClientTimeout]
    ] = None,
):
    """
    Instructions how to get Bot token is found here: https://core.telegram.org/bots#3-how-do-i-create-a-bot

    :param token: token from @BotFather
    :type token: :obj:`str`
    :param loop: event loop
    :type loop: Optional Union :obj:`asyncio.BaseEventLoop`, :obj:`asyncio.AbstractEventLoop`
    :param connections_limit: connections limit for aiohttp.ClientSession
    :type connections_limit: :obj:`int`
    :param proxy: HTTP proxy URL
    :type proxy: :obj:`str`
    :param proxy_auth: Authentication information
    :type proxy_auth: Optional :obj:`aiohttp.BasicAuth`
    :param validate_token: Validate token.
    :type validate_token: :obj:`bool`
    :param parse_mode: You can set default parse mode
    :type parse_mode: :obj:`str`
    :param timeout: Request timeout
    :type timeout: :obj:`typing.Optional[typing.Union[base.Integer, base.Float, aiohttp.ClientTimeout]]`
    :raise: when token is invalid throw an :obj:`aiogram.utils.exceptions.ValidationError`
    """
    # Authentication
    if validate_token:
        api.check_token(token)
    self._token = None
    self.__token = token
    self.id = int(token.split(sep=":")[0])

    self.proxy = proxy
    self.proxy_auth = proxy_auth

    # Asyncio loop instance
    if loop is None:
        loop = asyncio.get_event_loop()
    self.loop = loop

    # aiohttp main session
    ssl_context = ssl.create_default_context(cafile=certifi.where())

    self._session: Optional[aiohttp.ClientSession] = None
    self._connector_class: Type[aiohttp.TCPConnector] = aiohttp.TCPConnector
    self._connector_init = dict(
        limit=connections_limit, ssl=ssl_context, loop=self.loop
    )

    if isinstance(proxy, str) and (
        proxy.startswith("socks5://") or proxy.startswith("socks4://")
    ):
        from aiohttp_socks import SocksConnector
        from aiohttp_socks.utils import parse_proxy_url

        socks_ver, host, port, username, password = parse_proxy_url(proxy)
        if proxy_auth:
            if not username:
                username = proxy_auth.login
            if not password:
                password = proxy_auth.password

        self._connector_class = SocksConnector
        self._connector_init.update(
            socks_ver=socks_ver,
            host=host,
            port=port,
            username=username,
            password=password,
            rdns=True,
        )
        self.proxy = None
        self.proxy_auth = None

    self._timeout = None
    self.timeout = timeout

    self.parse_mode = parse_mode


# Traceback (RuntimeError)
INFO:     91.108.6.40:0 - "POST /updates/ HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 385, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
return await self.app(scope, receive, send)
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/starlette/applications.py", line 102, in __call__
await self.middleware_stack(scope, receive, send)
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
raise exc from None
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
await self.app(scope, receive, _send)
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
raise exc from None
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
await self.app(scope, receive, sender)
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/starlette/routing.py", line 550, in __call__
await route.handle(scope, receive, send)
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/starlette/routing.py", line 227, in handle
await self.app(scope, receive, send)
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/starlette/endpoints.py", line 30, in dispatch
response = await handler(request)
File "/home/vitaliy/coding/telegram-evernote-bot/src/views.py", line 57, in post
await process_update(update_data)
File "/home/vitaliy/coding/telegram-evernote-bot/src/services/updates.py", line 13, in process_update
return await dispatcher.process_update(update)
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/aiogram/dispatcher/dispatcher.py", line 214, in process_update
return await self.message_handlers.notify(update.message)
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/aiogram/dispatcher/handler.py", line 117, in notify
response = await handler_obj.handler(*args, **partial_data)
File "/home/vitaliy/coding/telegram-evernote-bot/src/bot.py", line 21, in send_help_message
await message.reply(
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/aiogram/types/message.py", line 995, in reply
return await self.bot.send_message(
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/aiogram/bot/bot.py", line 219, in send_message
result = await self.request(api.Methods.SEND_MESSAGE, payload)
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/aiogram/bot/base.py", line 201, in request
return await api.make_request(self.session, self.__token, method, data, files,
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/aiogram/bot/api.py", line 103, in make_request
async with session.post(url, data=req, **kwargs) as response:
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/aiohttp/client.py", line 1012, in __aenter__
self._resp = await self._coro
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/aiohttp/client.py", line 426, in _request
with timer:
File "/home/vitaliy/.cache/pypoetry/virtualenvs/telegram-evernote-bot-IC7bT7Nj-py3.8/lib/python3.8/site-packages/aiohttp/helpers.py", line 579, in __enter__
raise RuntimeError('Timeout context manager should be used '
RuntimeError: Timeout context manager should be used inside a task

# Fixed code
def __init__(
    self,
    token: base.String,
    loop: Optional[Union[asyncio.BaseEventLoop, asyncio.AbstractEventLoop]] = None,
    connections_limit: Optional[base.Integer] = None,
    proxy: Optional[base.String] = None,
    proxy_auth: Optional[aiohttp.BasicAuth] = None,
    validate_token: Optional[base.Boolean] = True,
    parse_mode: typing.Optional[base.String] = None,
    timeout: typing.Optional[
        typing.Union[base.Integer, base.Float, aiohttp.ClientTimeout]
    ] = None,
):
    """
    Instructions how to get Bot token is found here: https://core.telegram.org/bots#3-how-do-i-create-a-bot

    :param token: token from @BotFather
    :type token: :obj:`str`
    :param loop: event loop
    :type loop: Optional Union :obj:`asyncio.BaseEventLoop`, :obj:`asyncio.AbstractEventLoop`
    :param connections_limit: connections limit for aiohttp.ClientSession
    :type connections_limit: :obj:`int`
    :param proxy: HTTP proxy URL
    :type proxy: :obj:`str`
    :param proxy_auth: Authentication information
    :type proxy_auth: Optional :obj:`aiohttp.BasicAuth`
    :param validate_token: Validate token.
    :type validate_token: :obj:`bool`
    :param parse_mode: You can set default parse mode
    :type parse_mode: :obj:`str`
    :param timeout: Request timeout
    :type timeout: :obj:`typing.Optional[typing.Union[base.Integer, base.Float, aiohttp.ClientTimeout]]`
    :raise: when token is invalid throw an :obj:`aiogram.utils.exceptions.ValidationError`
    """
    self._main_loop = loop

    # Authentication
    if validate_token:
        api.check_token(token)
    self._token = None
    self.__token = token
    self.id = int(token.split(sep=":")[0])

    self.proxy = proxy
    self.proxy_auth = proxy_auth

    # aiohttp main session
    ssl_context = ssl.create_default_context(cafile=certifi.where())

    self._session: Optional[aiohttp.ClientSession] = None
    self._connector_class: Type[aiohttp.TCPConnector] = aiohttp.TCPConnector
    self._connector_init = dict(limit=connections_limit, ssl=ssl_context)

    if isinstance(proxy, str) and (
        proxy.startswith("socks5://") or proxy.startswith("socks4://")
    ):
        from aiohttp_socks import SocksConnector
        from aiohttp_socks.utils import parse_proxy_url

        socks_ver, host, port, username, password = parse_proxy_url(proxy)
        if proxy_auth:
            if not username:
                username = proxy_auth.login
            if not password:
                password = proxy_auth.password

        self._connector_class = SocksConnector
        self._connector_init.update(
            socks_ver=socks_ver,
            host=host,
            port=port,
            username=username,
            password=password,
            rdns=True,
        )
        self.proxy = None
        self.proxy_auth = None

    self._timeout = None
    self.timeout = timeout

    self.parse_mode = parse_mode