diff --git a/octobot/commands.py b/octobot/commands.py index 0528f4622..3d0978cf7 100644 --- a/octobot/commands.py +++ b/octobot/commands.py @@ -26,11 +26,11 @@ import octobot_commons.logging as logging import octobot_commons.constants as commons_constants import octobot_commons.errors as commons_errors +import octobot_commons.aiohttp_util as aiohttp_util import octobot_tentacles_manager.api as tentacles_manager_api import octobot_tentacles_manager.cli as tentacles_manager_cli -import octobot import octobot.api.strategy_optimizer as strategy_optimizer_api import octobot.logger as octobot_logger import octobot.constants as constants @@ -142,7 +142,9 @@ async def install_or_update_tentacles(config): async def install_all_tentacles(tentacles_url=None): if tentacles_url is None: tentacles_url = configuration_manager.get_default_tentacles_url() - async with aiohttp.ClientSession() as aiohttp_session: + async with aiohttp_util.ssl_fallback_aiohttp_client_session( + commons_constants.KNOWN_POTENTIALLY_SSL_FAILED_REQUIRED_URL + ) as aiohttp_session: for url in [tentacles_url] + ( constants.ADDITIONAL_TENTACLES_PACKAGE_URL.split(constants.URL_SEPARATOR) if constants.ADDITIONAL_TENTACLES_PACKAGE_URL else [] diff --git a/octobot/octobot.py b/octobot/octobot.py index f9a372386..60ecf5b64 100644 --- a/octobot/octobot.py +++ b/octobot/octobot.py @@ -16,7 +16,6 @@ import asyncio import time import uuid -import aiohttp import octobot_commons.constants as commons_constants import octobot_commons.enums as commons_enums @@ -27,6 +26,7 @@ import octobot_commons.tree as commons_tree import octobot_commons.os_clock_sync as os_clock_sync import octobot_commons.system_resources_watcher as system_resources_watcher +import octobot_commons.aiohttp_util as aiohttp_util import octobot_services.api as service_api import octobot_trading.api as trading_api @@ -222,6 +222,7 @@ async def stop(self): self.logger.info("Stopped, now shutting down.") async def _start_tools_tasks(self): + await self._init_aiohttp_session() self._init_community() await self.task_manager.start_tools_tasks() @@ -280,7 +281,11 @@ def run_in_main_asyncio_loop(self, coroutine, log_exceptions=True, def set_watcher(self, watcher): self.task_manager.watcher = watcher - def get_aiohttp_session(self): + async def _init_aiohttp_session(self): if self._aiohttp_session is None: - self._aiohttp_session = aiohttp.ClientSession() + self._aiohttp_session = await aiohttp_util.get_ssl_fallback_aiohttp_client_session( + commons_constants.KNOWN_POTENTIALLY_SSL_FAILED_REQUIRED_URL + ) + + def get_aiohttp_session(self): return self._aiohttp_session diff --git a/requirements.txt b/requirements.txt index 0d089abae..6c41d0b8a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ # Drakkar-Software requirements -OctoBot-Commons==1.9.43 +OctoBot-Commons==1.9.44 OctoBot-Trading==2.4.78 OctoBot-Evaluators==1.9.5 -OctoBot-Tentacles-Manager==2.9.10 +OctoBot-Tentacles-Manager==2.9.11 OctoBot-Services==1.6.13 OctoBot-Backtesting==1.9.7 Async-Channel==2.2.1