binance-connector-python icon indicating copy to clipboard operation
binance-connector-python copied to clipboard

After installed binance-futures-connector,binance-connector-python can not work

Open roc1 opened this issue 1 year ago • 1 comments

install new binance-connector-python(3.7.0) 2. install binance-futures-connector(4.0.0) 3. Run below code:

`from binance.websocket.spot.websocket_api import SpotWebsocketAPIClient

def message_handler(_, message): logging.info(message)

proxies = { 'http': 'http://1.2.3.4:8080' }

my_client = SpotWebsocketAPIClient(on_message=message_handler, proxies=proxies, timeout=10)

my_client.ticker(symbol="OPUSDT", type="FULL")

time.sleep(5) logging.info("closing ws connection") my_client.stop()`

Error: Traceback (most recent call last): File "E:\xx.py", line 10, in from binance.websocket.spot.websocket_api import SpotWebsocketAPIClient File "E:\xxx\venv\Lib\site-packages\binance\websocket\spot\websocket_api_init_.py", line 6, in class SpotWebsocketAPIClient(BinanceWebsocketClient): File "E:\xxx\venv\Lib\site-packages\binance\websocket\spot\websocket_api_init_.py", line 39, in SpotWebsocketAPIClient from binance.websocket.spot.websocket_api._market import ping_connectivity File "E:\xxx\venv\Lib\site-packages\binance\websocket\spot\websocket_api_market.py", line 1, in from binance.lib.utils import get_uuid, purge_map ImportError: cannot import name 'get_uuid' from 'binance.lib.utils' (E:\xxx\venv\Lib\site-packages\binance\lib\utils.py)


futures-connector rewrite utils.py file?

roc1 avatar Jun 15 '24 02:06 roc1

The problem is that both dependencies share the same package name i.e. binance.

A quick fix is to change the order of installation:

  1. Remove both packages
  2. Install binance-futures-connector
  3. Install binance-connector

chris-anjost avatar Jul 11 '24 08:07 chris-anjost

Hi @roc1 , I'm closing this issue as we published a brand new modularised version of the Python connector. Feel free to start using it and open a new issue if you encounter any problems.

alplabin avatar Jul 18 '25 12:07 alplabin