Websocket API user_data_stream_subscribe() method for Python SPOT SDK is failing with the error: 'dict' object has no attribute 'result'.
response.data() is returning a raw dict instead of a UserDataStreamSubscribeResponse model object. When the SDK then tries to access data.result, it fails because dicts use data['result'], not attribute access.
This is a deserialisation bug in the Binance Spot SDK:
- Internally, the SDK sends the WS message and calls
response.data() to parse the reply
- If the WS request times out or encounters an error, the SDK silently returns
{"error": "timeout"} (a raw dict) instead of a UserDataStreamSubscribeResponse model.
- The SDK then tries
data.result.subscription_id on that dict, which crashes with 'dict' object has no attribute 'result'
# Inside binance_sdk_spot/websocket_api/websocket_api.py:
response = await self._userDataStreamApi.user_data_stream_subscribe(id)
data = response.data()
stream = await RequestStream(
self,
data.result.subscription_id, # ERROR IS HERE
...
)
Websocket API user_data_stream_subscribe() method for Python SPOT SDK is failing with the error:
'dict' object has no attribute 'result'.response.data()is returning a raw dict instead of aUserDataStreamSubscribeResponsemodel object. When the SDK then tries to accessdata.result, it fails because dicts usedata['result'], not attribute access.This is a deserialisation bug in the Binance Spot SDK:
response.data()to parse the reply{"error": "timeout"}(a raw dict) instead of aUserDataStreamSubscribeResponsemodel.data.result.subscription_idon that dict, which crashes with 'dict' object has no attribute 'result'