Packeges:
binance-sdk-spot==8.2.0
binance-common==3.8.0
Python: 3.14
Bug description:
At binance-sdk-spot the both methods user_data_stream_subscribe_signature() and user_data_stream_subscribe() in websocket_api.py crash with AttributeError because they call .get() on a Pydantic BaseModel object, which does not have a .get() method:
# binance_sdk_spot/websocket_api/websocket_api.py
response = await self._userDataStreamApi.user_data_stream_subscribe_signature(
id, recv_window
)
data = response.data()
if data.get("result") is None or data.get("error") is not None: # <-- BUG
raise ValueError(data)
response.data() returns a UserDataStreamSubscribeSignatureResponse instance, which is a Pydantic BaseModel (defined in websocket_api/models/user_data_stream_subscribe_signature_response.py). Pydantic models do not have a .get() method - that is a dict method. The same bug exists for the non-signature variant user_data_stream_subscribe().
Suggested fix:
# if data.get("result") is None or data.get("error") is not None: # <-- delete this
if data.result is None or getattr(data, "error", None) is not None: # <-- add this
The identical fix applies to both line 3036 user_data_stream_subscribe() and line 3075 user_data_stream_subscribe_signature().
Packeges:
binance-sdk-spot==8.2.0
binance-common==3.8.0
Python: 3.14
Bug description:
At binance-sdk-spot the both methods
user_data_stream_subscribe_signature()anduser_data_stream_subscribe()inwebsocket_api.pycrash with AttributeError because they call.get()on a PydanticBaseModelobject, which does not have a.get()method:response.data()returns aUserDataStreamSubscribeSignatureResponseinstance, which is a PydanticBaseModel(defined inwebsocket_api/models/user_data_stream_subscribe_signature_response.py). Pydantic models do not have a.get()method - that is a dict method. The same bug exists for the non-signature variantuser_data_stream_subscribe().Suggested fix:
The identical fix applies to both line 3036
user_data_stream_subscribe()and line 3075user_data_stream_subscribe_signature().