Skip to content

Commit 1b3f1c9

Browse files
committed
docs: add async init for initialization.rst
1 parent 03eb916 commit 1b3f1c9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/usage/initialization.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@ Basic initialization which is going to work for everybody:
2121
2222
northwind = pyodata.Client(SERVICE_URL, requests.Session())
2323
24+
Get the service for async libraries
25+
-----------------------------------
26+
27+
Initialization of the session instance is dependent on particular library,
28+
but also must have API compatible Session_ from Requests_.
29+
30+
.. code-block:: python
31+
32+
import httpx
33+
import aiohttp
34+
35+
SERVICE_URL = 'http://services.odata.org/V2/Northwind/Northwind.svc/'
36+
37+
service_httpx = await pyodata.Client.build_async_client(SERVICE_URL, httpx)
38+
service_aiohttp = await pyodata.Client.build_async_client(SERVICE_URL, aiohttp.ClientSession())
39+
2440
Get the service proxy client for an OData service requiring sap-client parameter
2541
--------------------------------------------------------------------------------
2642

0 commit comments

Comments
 (0)