binance / binance-connector-python

Simple connector to Binance Public API
MIT License
1.89k stars 490 forks source link

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

Open roc1 opened 2 months ago

roc1 commented 2 months ago

1. 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 messagehandler(, 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?

chris-anjost commented 1 month ago

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