docs/usage.rst
raw| 1 | ===== |
| 2 | Usage |
| 3 | ===== |
| 4 | |
| 5 | To use SSE Client in a project: |
| 6 | |
| 7 | .. code-block:: python |
| 8 | |
| 9 | from aiohttp_sse_client2 import client as sse_client |
| 10 | |
| 11 | async with sse_client.EventSource( |
| 12 | 'https://stream.wikimedia.org/v2/stream/recentchange' |
| 13 | ) as event_source: |
| 14 | try: |
| 15 | async for event in event_source: |
| 16 | print(event) |
| 17 | except ConnectionError: |
| 18 | pass |