Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ssl #2604

Merged
merged 2 commits into from
Apr 18, 2024
Merged

Ssl #2604

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions octobot/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 []
Expand Down
11 changes: 8 additions & 3 deletions octobot/octobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading