diff options
Diffstat (limited to 'testing/web-platform/tests/tools/third_party/websockets/example/legacy/basic_auth_client.py')
-rw-r--r-- | testing/web-platform/tests/tools/third_party/websockets/example/legacy/basic_auth_client.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/web-platform/tests/tools/third_party/websockets/example/legacy/basic_auth_client.py b/testing/web-platform/tests/tools/third_party/websockets/example/legacy/basic_auth_client.py new file mode 100644 index 0000000000..164732152f --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/websockets/example/legacy/basic_auth_client.py @@ -0,0 +1,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()) |