-
Notifications
You must be signed in to change notification settings - Fork 599
Closed
Description
Line 128 in e707698
self.websocket_base, listenKey, response_model=UserDataStreamEventsResponse |
self
has no attribute websocket_base
i think it should be self
instead of self.websocket_base
(since self
inherits from WebsocketBase
.)
when i run:
import asyncio
import os
from binance_common.configuration import ConfigurationRestAPI
from binance_common.configuration import ConfigurationWebSocketStreams
from binance_common.constants import (
DERIVATIVES_TRADING_USDS_FUTURES_REST_API_TESTNET_URL,
)
from binance_common.constants import (
DERIVATIVES_TRADING_USDS_FUTURES_WS_STREAMS_TESTNET_URL,
)
from binance_sdk_derivatives_trading_usds_futures import DerivativesTradingUsdsFutures
from dotenv import load_dotenv
async def main():
load_dotenv()
rest_config = ConfigurationRestAPI(
api_key=os.getenv("BINANCE_API_KEY"),
api_secret=os.getenv("BINANCE_API_SECRET"),
base_path=DERIVATIVES_TRADING_USDS_FUTURES_REST_API_TESTNET_URL,
)
ws_config = ConfigurationWebSocketStreams(stream_url=DERIVATIVES_TRADING_USDS_FUTURES_WS_STREAMS_TESTNET_URL)
client = DerivativesTradingUsdsFutures(config_rest_api=rest_config, config_ws_streams=ws_config)
response = client.rest_api.start_user_data_stream()
listen_key = response.data().listen_key
await client.websocket_streams.create_connection()
# This line triggers the bug
await client.websocket_streams.user_data(listenKey=listen_key)
if __name__ == "__main__":
asyncio.run(main())
i get:
Traceback (most recent call last):
File "/Users/dominiquegarmier/Documents/workspace/foo/bar.py", line 36, in <module>
asyncio.run(main())
File "/opt/homebrew/Cellar/[email protected]/3.10.17/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/opt/homebrew/Cellar/[email protected]/3.10.17/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/Users/dominiquegarmier/Documents/workspace/foo/bar.py", line 33, in main
await client.websocket_streams.user_data(listenKey=listen_key)
File "/Users/dominiquegarmier/Documents/workspace/foo/.venv/lib/python3.10/site-packages/binance_sdk_derivatives_trading_usds_futures/websocket_streams/websocket_streams.py", line 128, in user_data
self.websocket_base, listenKey, response_model=UserDataStreamEventsResponse
AttributeError: 'DerivativesTradingUsdsFuturesWebSocketStreams' object has no attribute 'websocket_base'
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x1071245b0>
Metadata
Metadata
Assignees
Labels
No labels