/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
websocket__examples/echo_client__using_websockets.py
28 строк
543 B
gil9red
Refactoring. Using black code style
28 июн 2023, 15:51
28 июн 2023, 15:51
533019c
Код
Авторство
О чём код?
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "ipetrash" # SOURCE: https://github.com/aaugustin/websockets import asyncio # pip install websockets import websockets async def hello(url: str): async with websockets.connect(url) as websocket: await websocket.send("Hello World!") print(await websocket.recv()) # Hello World! if __name__ == "__main__": # From http://websocket.org/echo.html url = "wss://echo.websocket.org" asyncio.get_event_loop().run_until_complete(hello(url))