OctoBot-Trading icon indicating copy to clipboard operation
OctoBot-Trading copied to clipboard

Proxy Error

Open qdwds opened this issue 6 months ago • 0 comments

Hi sir, I found an error when configuring the proxy, but the environment variables exist. Since I am not familiar with python, I can post the problem below. I hope it can be solved because I cannot access any exchange with the proxy. Thank you

error code .pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/connectors/ccxt/ccxt_client_util.py

def _use_proxy_if_necessary(client, proxy_config: proxy_config_import.ProxyConfig):
  ...
        print("----------------")
        print(os.getenv("EXCHANGE_HTTP_PROXY_AUTHENTICATED_URL"))
        print(proxy_config)
        print(proxy_config.get_proxy_url())
        proxy_url = proxy_config.get_proxy_url()
        print("*******************")
        if (client.socks_proxy_sessions is None):
            client.socks_proxy_sessions = {}
        if (proxy_url not in client.socks_proxy_sessions):
          .....

ERROR

----------------
http://127.0.0.1:1087
ProxyConfig(http_proxy='http://127.0.0.1:1087', http_proxy_callback=None, https_proxy='https://127.0.0.1:1087', https_proxy_callback=None, socks_proxy='socks5h://127.0.0.1:1086', socks_proxy_callback=None, aiohttp_trust_env=True, stop_proxy_callback=None, get_last_proxied_request_url=None, get_proxy_url=None, proxy_host='DEFAULT PROXY HOST', disable_dns_cache=False)
 2025-06-21 23:58:40,979 ERROR    CCXTConnector[binance] Exchange configuration is invalid : please check your configuration ! (TypeError: 'NoneType' object is not callable)
----------------
http://127.0.0.1:1087
ProxyConfig(http_proxy='http://127.0.0.1:1087', http_proxy_callback=None, https_proxy='https://127.0.0.1:1087', https_proxy_callback=None, socks_proxy='socks5h://127.0.0.1:1086', socks_proxy_callback=None, aiohttp_trust_env=True, stop_proxy_callback=None, get_last_proxied_request_url=None, get_proxy_url=None, proxy_host='DEFAULT PROXY HOST', disable_dns_cache=False)
 2025-06-21 23:58:41,009 ERROR    OctoBotChannelTradingConsumer 'NoneType' object is not callable
Traceback (most recent call last):
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/connectors/ccxt/ccxt_client_util.py", line 83, in create_client
    client = instantiate_exchange(
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/connectors/ccxt/ccxt_client_util.py", line 145, in instantiate_exchange
    _use_proxy_if_necessary(client, proxy_config)
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/connectors/ccxt/ccxt_client_util.py", line 317, in _use_proxy_if_necessary
    print(proxy_config.get_proxy_url())
TypeError: 'NoneType' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/octobot_channel_consumer.py", line 84, in _handle_creation
    await exchange_builder.build()
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/exchange_builder.py", line 52, in build
    raise e
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/exchange_builder.py", line 48, in build
    await self._build_exchange_manager()
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/exchange_builder.py", line 70, in _build_exchange_manager
    await self.exchange_manager.initialize(exchange_config_by_exchange=self.exchange_config_by_exchange)
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/util/initializable.py", line 28, in initialize
    await self.initialize_impl(**kwargs)
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/exchange_manager.py", line 93, in initialize_impl
    await exchanges.create_exchanges(self, exchange_config_by_exchange)
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/exchange_factory.py", line 36, in create_exchanges
    await create_real_exchange(exchange_manager, exchange_config_by_exchange)
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/exchange_factory.py", line 57, in create_real_exchange
    await _create_rest_exchange(exchange_manager, exchange_config_by_exchange)
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/exchange_factory.py", line 136, in _create_rest_exchange
    await _search_and_create_rest_exchange(exchange_manager, exchange_config_by_exchange)
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/exchange_factory.py", line 172, in _search_and_create_rest_exchange
    exchange_manager.exchange = rest_exchange_class(
  File "/Users/loser/Desktop/OctoBot/tentacles/Trading/Exchange/binance/binance_exchange.py", line 115, in __init__
    super().__init__(config, exchange_manager, exchange_config_by_exchange, connector_class=connector_class)
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/types/rest_exchange.py", line 152, in __init__
    self.connector = self._create_connector(config, exchange_manager, connector_class)
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/types/rest_exchange.py", line 156, in _create_connector
    return (connector_class or self.DEFAULT_CONNECTOR_CLASS)(
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/connectors/ccxt/ccxt_connector.py", line 87, in __init__
    self._create_client()
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/connectors/ccxt/ccxt_connector.py", line 247, in _create_client
    self.client, self.is_authenticated = self._client_factory(force_unauth)
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/connectors/ccxt/ccxt_connector.py", line 254, in _client_factory
    return ccxt_client_util.create_client(
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/connectors/ccxt/ccxt_client_util.py", line 96, in create_client
    return unauthenticated_exchange_fallback(e), False
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/connectors/ccxt/ccxt_connector.py", line 272, in unauthenticated_exchange_fallback
    return ccxt_client_util.get_unauthenticated_exchange(
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/connectors/ccxt/ccxt_client_util.py", line 132, in get_unauthenticated_exchange
    return instantiate_exchange(
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/connectors/ccxt/ccxt_client_util.py", line 145, in instantiate_exchange
    _use_proxy_if_necessary(client, proxy_config)
  File "/Users/loser/.pyenv/versions/3.10.11/lib/python3.10/site-packages/octobot_trading/exchanges/connectors/ccxt/ccxt_client_util.py", line 317, in _use_proxy_if_necessary
    print(proxy_config.get_proxy_url())
TypeError: 'NoneType' object is not callable
 2025-06-21 23:58:41,023 ERROR    OctoBotChannelTradingConsumer Error when creating a new binance exchange connexion: TypeError 'NoneType' object is not callable (error: TypeError)
 2025-06-21 23:58:46,027 WARNING  WebService           Impossible to find local web interface url, using default instead: [Errno 8] nodename nor servname provided, or not known (gaierror)
 2025-06-21 23:58:46,028 INFO     WebService           Interface successfully initialized and accessible at: http://127.0.0.1:5001.
 2025-06-21 23:58:51,204 WARNING  WebInterface         Impossible to open automatically web interface: [Errno 8] nodename nor servname provided, or not known (gaierror)

qdwds avatar Jun 21 '25 16:06 qdwds