why i cant not recv any data for websocket

the code follow:

import asyncio
import websockets
import ssl

async def test_ws_quote():
bnwsuri = ‘wss://fstream.binance.com/stream?streams=btcusdt@bookTicker/ethusdt@bookTicker’
async with websockets.connect(bnwsuri,ssl=ssl.SSLContext(protocol=ssl.PROTOCOL_TLS)) as ws:
while True:
recvData = await asyncio.wait_for(ws.recv(), timeout=30)
print(recvData)

if name == “main”:
asyncio.get_event_loop().run_until_complete(test_ws_quote())

but run it i can not receive any data, where is the error?

Should be if __name__ == "__main__":

main” in code have no error, here it does not show the “__”, because of this web js…

I directly copied your code, with only changing commas, indent and the __name__ == "__main__" part and can receive updates:

import asyncio
import websockets
import ssl

async def test_ws_quote():
        bnwsuri = "wss://fstream.binance.com/stream?streams=btcusdt@bookTicker/ethusdt@bookTicker"
        async with websockets.connect(bnwsuri,ssl=ssl.SSLContext(protocol=ssl.PROTOCOL_TLS)) as ws:
                while True:
                        recvData = await asyncio.wait_for(ws.recv(), timeout=30)
                        print(recvData)

if __name__ == "__main__":
        asyncio.get_event_loop().run_until_complete(test_ws_quote())

Note: As good practice, you should put try and except blocks.