python3-commons 0.18.1__py3-none-any.whl → 0.18.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,8 @@ Async SOAP client built on aiohttp + zeep.
4
4
 
5
5
  from __future__ import annotations
6
6
 
7
+ import asyncio
8
+ import concurrent.futures
7
9
  import logging
8
10
  from collections.abc import AsyncIterator, Sequence
9
11
  from contextlib import asynccontextmanager
@@ -165,6 +167,20 @@ class AsyncTransport(Transport):
165
167
 
166
168
  return await _fetch()
167
169
 
170
+ def load(self, url: str) -> bytes:
171
+ """Sync entry-point zeep calls during WSDL document init."""
172
+ if not url:
173
+ return b''
174
+
175
+ try:
176
+ loop = asyncio.get_event_loop()
177
+
178
+ return loop.run_until_complete(self._load_remote_data(url))
179
+ except RuntimeError:
180
+ with concurrent.futures.ThreadPoolExecutor(max_workers=1) as pool:
181
+ future = pool.submit(asyncio.run, self._load_remote_data(url))
182
+ return future.result()
183
+
168
184
  async def post(
169
185
  self,
170
186
  address: str,
@@ -256,5 +272,9 @@ async def soap_client(
256
272
  """
257
273
  transport = AsyncTransport.from_config(config, session=session)
258
274
 
259
- async with transport:
260
- yield build_soap_client(wsdl_url, transport, plugins)
275
+ try:
276
+ client = build_soap_client(wsdl_url, transport, plugins) # WSDL loaded here (sync via load())
277
+
278
+ yield client
279
+ finally:
280
+ await transport.aclose()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python3-commons
3
- Version: 0.18.1
3
+ Version: 0.18.2
4
4
  Summary: Re-usable Python3 code
5
5
  Author-email: Oleg Korsak <kamikaze.is.waiting.you@gmail.com>
6
6
  License-Expression: GPL-3.0
@@ -11,7 +11,7 @@ python3_commons/generators.py,sha256=P6sKdCFhHT79-DZgzPU-qmwZvHg3wU8a75UFIwrycOY
11
11
  python3_commons/helpers.py,sha256=2U0XyiBhylPrPIdPkZ16jrJRDZBE-yKv9GjRIY4C-EA,4541
12
12
  python3_commons/object_storage.py,sha256=JB39Wb6rluAHa9oprsmB8d9UlY3sehsjX-aFmY_A-us,7219
13
13
  python3_commons/permissions.py,sha256=gaMKSWg0MgPQTdP1voll4ItXcblXku9BlD0Lq3Xv64U,1724
14
- python3_commons/soap_client.py,sha256=rWNMlcY7f3xsC_99xCiKaLQuA2ljcwp7PGX7kSsmK98,7654
14
+ python3_commons/soap_client.py,sha256=dZZWkg2RxFWr5yHfzcDK7SCy21FMfxctuDCoYiRBJII,8296
15
15
  python3_commons/db/__init__.py,sha256=i60JvWiUY8kz8nEaVjc5MA1IN_P5g3tK7jX8KgcUd0Y,3105
16
16
  python3_commons/db/helpers.py,sha256=xRpWs4aVkBge6HCLjb6OLSnWc1nlV6rKGyaVhZ_x12w,2001
17
17
  python3_commons/db/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -27,9 +27,9 @@ python3_commons/serializers/common.py,sha256=VkA7C6wODvHk0QBXVX_x2JieDstihx3U__U
27
27
  python3_commons/serializers/json.py,sha256=UPkC3ps13x2C_NxwVV-K7Ewp4VjkVHSSUkJVw5k7Wiw,712
28
28
  python3_commons/serializers/msgpack.py,sha256=zESFBX34GsZ8rDu6Zk5V6CLT6P0mPilU0r04Ka6TblI,1474
29
29
  python3_commons/serializers/msgspec.py,sha256=upy5CBmK66-8hYnK5bAM_sZvZY5CAqZmzCw9GIF346I,2988
30
- python3_commons-0.18.1.dist-info/licenses/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
31
- python3_commons-0.18.1.dist-info/licenses/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
32
- python3_commons-0.18.1.dist-info/METADATA,sha256=LrvIFn83FNLRRUIFDj6_v_rtk4C7-uU7or895O5nv-k,2160
33
- python3_commons-0.18.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
34
- python3_commons-0.18.1.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
35
- python3_commons-0.18.1.dist-info/RECORD,,
30
+ python3_commons-0.18.2.dist-info/licenses/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
31
+ python3_commons-0.18.2.dist-info/licenses/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
32
+ python3_commons-0.18.2.dist-info/METADATA,sha256=kIEA0rAgEB2EWJF1BCMXFPhRmxKK4oVasgPbNyZQAoo,2160
33
+ python3_commons-0.18.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
34
+ python3_commons-0.18.2.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
35
+ python3_commons-0.18.2.dist-info/RECORD,,