Skip to content

Commit aed7b96

Browse files
authored
Add references in doc (#26)
1 parent 4eb09ea commit aed7b96

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed

aiohttp_sse_client/client.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@ class MessageEvent:
4141
class EventSource:
4242
"""Represent EventSource Interface as an async context manager.
4343
44+
.. code-block:: python
45+
46+
from aiohttp_sse_client import client as sse_client
47+
48+
async with sse_client.EventSource(
49+
'https://stream.wikimedia.org/v2/stream/recentchange'
50+
) as event_source:
51+
try:
52+
async for event in event_source:
53+
print(event)
54+
except ConnectionError:
55+
pass
56+
4457
.. seealso:: https://www.w3.org/TR/eventsource/#eventsource
4558
"""
4659
def __init__(self, url: str,
@@ -65,6 +78,8 @@ def __init__(self, url: str,
6578
:param on_open: event handler for open event
6679
:param on_message: event handler for message event
6780
:param on_error: event handler for error event
81+
:param kwargs: keyword arguments will pass to underlying aiohttp get()
82+
method.
6883
"""
6984
self._url = URL(url)
7085
if option is not None:

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
# General information about the project.
5050
project = u'SSE Client'
51-
copyright = u"2018-2019, Jason Hu"
51+
copyright = u"2018-2020, Jason Hu"
5252
author = u"Jason Hu"
5353

5454
# The version info for the project you're documenting, acts as replacement

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Welcome to SSE Client's documentation!
88
readme
99
installation
1010
usage
11+
references
1112
modules
1213
contributing
1314
authors

docs/references.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
==========
2+
References
3+
==========
4+
5+
Class EventSource
6+
-----------------
7+
8+
.. autoclass:: aiohttp_sse_client.client.EventSource
9+
:members:
10+
11+
.. automethod:: __init__
12+
13+
Class MessageEvent
14+
------------------
15+
16+
.. autoclass:: aiohttp_sse_client.client.MessageEvent
17+
:members:

0 commit comments

Comments
 (0)