summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/tools/third_party/websockets/example/legacy/basic_auth_client.py
blob: 164732152f6d44a3d0994cf85f9aa7ba099223a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env python

# WS client example with HTTP Basic Authentication

import asyncio
import websockets

async def hello():
    uri = "ws://mary:p@ssw0rd@localhost:8765"
    async with websockets.connect(uri) as websocket:
        greeting = await websocket.recv()
        print(greeting)

asyncio.run(hello())