Skip to content

Commit 024f6e1

Browse files
committed
Improve docs
1 parent efc7352 commit 024f6e1

File tree

1 file changed

+47
-29
lines changed

1 file changed

+47
-29
lines changed

docs/client_reference.rst

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,15 @@ The client session supports the context manager protocol for self closing.
119119
forbidden, but you may modify the object in-place if needed.
120120

121121

122-
.. coroutinemethod:: request(method, url, *, params=None, data=None,\
123-
headers=None, skip_auto_headers=None, \
124-
auth=None, allow_redirects=True,\
125-
max_redirects=10, encoding='utf-8',\
126-
version=HttpVersion(major=1, minor=1),\
127-
compress=None, chunked=None, expect100=False,\
128-
read_until_eof=True)
122+
.. comethod:: request(method, url, *, params=None, data=None,\
123+
headers=None, skip_auto_headers=None, \
124+
auth=None, allow_redirects=True,\
125+
max_redirects=10, encoding='utf-8',\
126+
version=HttpVersion(major=1, minor=1),\
127+
compress=None, chunked=None, expect100=False,\
128+
read_until_eof=True)
129+
:async-with:
130+
:coroutine:
129131

130132
Performs an asynchronous HTTP request. Returns a response object.
131133

@@ -191,7 +193,9 @@ The client session supports the context manager protocol for self closing.
191193
:return ClientResponse: a :class:`client response
192194
<ClientResponse>` object.
193195

194-
.. coroutinemethod:: get(url, *, allow_redirects=True, **kwargs)
196+
.. comethod:: get(url, *, allow_redirects=True, **kwargs)
197+
:async-with:
198+
:coroutine:
195199

196200
Perform a ``GET`` request.
197201

@@ -207,7 +211,9 @@ The client session supports the context manager protocol for self closing.
207211
:return ClientResponse: a :class:`client response
208212
<ClientResponse>` object.
209213

210-
.. coroutinemethod:: post(url, *, data=None, **kwargs)
214+
.. comethod:: post(url, *, data=None, **kwargs)
215+
:async-with:
216+
:coroutine:
211217

212218
Perform a ``POST`` request.
213219

@@ -224,7 +230,9 @@ The client session supports the context manager protocol for self closing.
224230
:return ClientResponse: a :class:`client response
225231
<ClientResponse>` object.
226232

227-
.. coroutinemethod:: put(url, *, data=None, **kwargs)
233+
.. comethod:: put(url, *, data=None, **kwargs)
234+
:async-with:
235+
:coroutine:
228236

229237
Perform a ``PUT`` request.
230238

@@ -241,7 +249,9 @@ The client session supports the context manager protocol for self closing.
241249
:return ClientResponse: a :class:`client response
242250
<ClientResponse>` object.
243251

244-
.. coroutinemethod:: delete(url, **kwargs)
252+
.. comethod:: delete(url, **kwargs)
253+
:async-with:
254+
:coroutine:
245255

246256
Perform a ``DELETE`` request.
247257

@@ -254,7 +264,9 @@ The client session supports the context manager protocol for self closing.
254264
:return ClientResponse: a :class:`client response
255265
<ClientResponse>` object.
256266

257-
.. coroutinemethod:: head(url, *, allow_redirects=False, **kwargs)
267+
.. comethod:: head(url, *, allow_redirects=False, **kwargs)
268+
:async-with:
269+
:coroutine:
258270

259271
Perform a ``HEAD`` request.
260272

@@ -270,7 +282,9 @@ The client session supports the context manager protocol for self closing.
270282
:return ClientResponse: a :class:`client response
271283
<ClientResponse>` object.
272284

273-
.. coroutinemethod:: options(url, *, allow_redirects=True, **kwargs)
285+
.. comethod:: options(url, *, allow_redirects=True, **kwargs)
286+
:async-with:
287+
:coroutine:
274288

275289
Perform an ``OPTIONS`` request.
276290

@@ -287,7 +301,9 @@ The client session supports the context manager protocol for self closing.
287301
:return ClientResponse: a :class:`client response
288302
<ClientResponse>` object.
289303

290-
.. coroutinemethod:: patch(url, *, data=None, **kwargs)
304+
.. comethod:: patch(url, *, data=None, **kwargs)
305+
:async-with:
306+
:coroutine:
291307

292308
Perform a ``PATCH`` request.
293309

@@ -304,11 +320,13 @@ The client session supports the context manager protocol for self closing.
304320
:return ClientResponse: a :class:`client response
305321
<ClientResponse>` object.
306322

307-
.. coroutinemethod:: ws_connect(url, *, protocols=(), timeout=10.0,\
308-
auth=None,\
309-
autoclose=True,\
310-
autoping=True,\
311-
origin=None)
323+
.. comethod:: ws_connect(url, *, protocols=(), timeout=10.0,\
324+
auth=None,\
325+
autoclose=True,\
326+
autoping=True,\
327+
origin=None)
328+
:async-with:
329+
:coroutine:
312330

313331
Create a websocket connection. Returns a
314332
:class:`ClientWebSocketResponse` object.
@@ -343,7 +361,7 @@ The client session supports the context manager protocol for self closing.
343361

344362
Add *origin* parameter.
345363

346-
.. coroutinemethod:: close()
364+
.. comethod:: close()
347365

348366
Close underlying connector.
349367

@@ -715,7 +733,7 @@ BaseConnector
715733

716734
.. versionadded:: 0.16
717735

718-
.. coroutinemethod:: close()
736+
.. comethod:: close()
719737

720738
Close all opened connections.
721739

@@ -725,7 +743,7 @@ BaseConnector
725743
returns a future for keeping backward compatibility during
726744
transition period).
727745

728-
.. coroutinemethod:: connect(request)
746+
.. comethod:: connect(request)
729747

730748
Get a free connection from pool or create new one if connection
731749
is absent in the pool.
@@ -739,7 +757,7 @@ BaseConnector
739757

740758
:return: :class:`Connection` object.
741759

742-
.. coroutinemethod:: _create_connection(req)
760+
.. comethod:: _create_connection(req)
743761

744762
Abstract method for actual connection establishing, should be
745763
overridden in subclasses.
@@ -1111,7 +1129,7 @@ Response object
11111129

11121130
For :term:`keep-alive` support see :meth:`release`.
11131131

1114-
.. coroutinemethod:: read()
1132+
.. comethod:: read()
11151133

11161134
Read the whole response's body as :class:`bytes`.
11171135

@@ -1122,13 +1140,13 @@ Response object
11221140

11231141
.. seealso:: :meth:`close`, :meth:`release`.
11241142

1125-
.. coroutinemethod:: release()
1143+
.. comethod:: release()
11261144

11271145
Finish response processing, release underlying connection and
11281146
return it into free connection pool for re-usage by next upcoming
11291147
request.
11301148

1131-
.. coroutinemethod:: text(encoding=None)
1149+
.. comethod:: text(encoding=None)
11321150

11331151
Read response's body and return decoded :class:`str` using
11341152
specified *encoding* parameter.
@@ -1146,7 +1164,7 @@ Response object
11461164

11471165
:return str: decoded *BODY*
11481166

1149-
.. coroutinemethod:: json(encoding=None, loads=json.loads)
1167+
.. comethod:: json(encoding=None, loads=json.loads)
11501168

11511169
Read response's body as *JSON*, return :class:`dict` using
11521170
specified *encoding* and *loader*.
@@ -1222,7 +1240,7 @@ manually.
12221240
:raise TypeError: if data is not :class:`bytes`,
12231241
:class:`bytearray` or :class:`memoryview`.
12241242

1225-
.. coroutinemethod:: close(*, code=1000, message=b'')
1243+
.. comethod:: close(*, code=1000, message=b'')
12261244

12271245
A :ref:`coroutine<coroutine>` that initiates closing handshake by sending
12281246
:const:`~aiohttp.websocket.MSG_CLOSE` message. It waits for
@@ -1235,7 +1253,7 @@ manually.
12351253
:class:`str` (converted to *UTF-8* encoded bytes)
12361254
or :class:`bytes`.
12371255

1238-
.. coroutinemethod:: receive()
1256+
.. comethod:: receive()
12391257

12401258
A :ref:`coroutine<coroutine>` that waits upcoming *data*
12411259
message from peer and returns it.

0 commit comments

Comments
 (0)