From 1b3f1c95f13255fb599d65f212e1676da335e83c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Han=C3=A1k?= <47626173+phanak-sap@users.noreply.github.com> Date: Tue, 19 Dec 2023 13:47:04 +0100 Subject: [PATCH] docs: add async init for initialization.rst --- docs/usage/initialization.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/usage/initialization.rst b/docs/usage/initialization.rst index 79cbca2b..349200ab 100644 --- a/docs/usage/initialization.rst +++ b/docs/usage/initialization.rst @@ -21,6 +21,22 @@ Basic initialization which is going to work for everybody: northwind = pyodata.Client(SERVICE_URL, requests.Session()) +Get the service for async libraries +----------------------------------- + +Initialization of the session instance is dependent on particular library, +but also must have API compatible Session_ from Requests_. + +.. code-block:: python + + import httpx + import aiohttp + + SERVICE_URL = 'http://services.odata.org/V2/Northwind/Northwind.svc/' + + service_httpx = await pyodata.Client.build_async_client(SERVICE_URL, httpx) + service_aiohttp = await pyodata.Client.build_async_client(SERVICE_URL, aiohttp.ClientSession()) + Get the service proxy client for an OData service requiring sap-client parameter --------------------------------------------------------------------------------