polyapi-python 0.3.15__py3-none-any.whl → 0.3.16__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.
- polyapi/http_client.py +16 -6
- {polyapi_python-0.3.15.dist-info → polyapi_python-0.3.16.dist-info}/METADATA +1 -1
- {polyapi_python-0.3.15.dist-info → polyapi_python-0.3.16.dist-info}/RECORD +6 -6
- {polyapi_python-0.3.15.dist-info → polyapi_python-0.3.16.dist-info}/WHEEL +0 -0
- {polyapi_python-0.3.15.dist-info → polyapi_python-0.3.16.dist-info}/licenses/LICENSE +0 -0
- {polyapi_python-0.3.15.dist-info → polyapi_python-0.3.16.dist-info}/top_level.txt +0 -0
polyapi/http_client.py
CHANGED
|
@@ -3,6 +3,7 @@ import httpx
|
|
|
3
3
|
|
|
4
4
|
_sync_client: httpx.Client | None = None
|
|
5
5
|
_async_client: httpx.AsyncClient | None = None
|
|
6
|
+
_async_client_loop: asyncio.AbstractEventLoop | None = None
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def _get_sync_client() -> httpx.Client:
|
|
@@ -13,9 +14,11 @@ def _get_sync_client() -> httpx.Client:
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
def _get_async_client() -> httpx.AsyncClient:
|
|
16
|
-
global _async_client
|
|
17
|
-
|
|
17
|
+
global _async_client, _async_client_loop
|
|
18
|
+
current_loop = asyncio.get_running_loop()
|
|
19
|
+
if _async_client is None or _async_client_loop is not current_loop:
|
|
18
20
|
_async_client = httpx.AsyncClient(timeout=None)
|
|
21
|
+
_async_client_loop = current_loop
|
|
19
22
|
return _async_client
|
|
20
23
|
|
|
21
24
|
|
|
@@ -66,8 +69,15 @@ def close():
|
|
|
66
69
|
_sync_client = None
|
|
67
70
|
|
|
68
71
|
async def close_async():
|
|
69
|
-
global _sync_client, _async_client
|
|
72
|
+
global _sync_client, _async_client, _async_client_loop
|
|
70
73
|
close()
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
client = _async_client
|
|
75
|
+
client_loop = _async_client_loop
|
|
76
|
+
_async_client = None
|
|
77
|
+
_async_client_loop = None
|
|
78
|
+
if client is None:
|
|
79
|
+
return
|
|
80
|
+
|
|
81
|
+
current_loop = asyncio.get_running_loop()
|
|
82
|
+
if client_loop is current_loop:
|
|
83
|
+
await client.aclose()
|
|
@@ -13,7 +13,7 @@ polyapi/exceptions.py,sha256=Zh7i7eCUhDuXEdUYjatkLFTeZkrx1BJ1P5ePgbJ9eIY,89
|
|
|
13
13
|
polyapi/execute.py,sha256=MeAmc5qsMQfnQPiHJK9Khkn_wrBxMoyMYYqmuFFPsRg,8779
|
|
14
14
|
polyapi/function_cli.py,sha256=kKrecKCDNMmYtcOOCVF2KKOGjFUfWD2TbiVsyYQ84y8,4323
|
|
15
15
|
polyapi/generate.py,sha256=TjMlxxjWN1WnFEmOjSygFcl9RkHCZeCq79R-K_7GYRU,21059
|
|
16
|
-
polyapi/http_client.py,sha256=
|
|
16
|
+
polyapi/http_client.py,sha256=Pd6FYHGB6plWlBbwZD9LPP6FEicdp0wyLWHd_9jxsaY,2273
|
|
17
17
|
polyapi/parser.py,sha256=pAkeuwp1Kn6bHXiIoj-DuXQ518PztQThIa8vztgsKLQ,21525
|
|
18
18
|
polyapi/poly_schemas.py,sha256=fZ6AGvHcOKQJtlrzSuzeBNed5DxPMA2dJGdJvuFCHWM,9066
|
|
19
19
|
polyapi/poly_tables.py,sha256=T07j4H-HdcIFP5HwUq0uljpzzYzMtJvdqYvOdC0oZ4I,19728
|
|
@@ -27,8 +27,8 @@ polyapi/typedefs.py,sha256=mfll-KrngOW0wzbvDNiIDaDkFMwbsT-MY5y5hzWj9RE,5642
|
|
|
27
27
|
polyapi/utils.py,sha256=VN8n_jvphderplI5MDYjSutxVnYbJjHhJznYkwjgstw,13349
|
|
28
28
|
polyapi/variables.py,sha256=hfSDPGQK6YphNCa9MqE0W88WIFfqCQWgpBDWkExMq-A,7582
|
|
29
29
|
polyapi/webhook.py,sha256=0ceLwHNjNd2Yx_8MX5jOIxiQ5Lwhy2pe81ProAuKon0,5108
|
|
30
|
-
polyapi_python-0.3.
|
|
31
|
-
polyapi_python-0.3.
|
|
32
|
-
polyapi_python-0.3.
|
|
33
|
-
polyapi_python-0.3.
|
|
34
|
-
polyapi_python-0.3.
|
|
30
|
+
polyapi_python-0.3.16.dist-info/licenses/LICENSE,sha256=6b_I7aPVp8JXhqQwdw7_B84Ca0S4JGjHj0sr_1VOdB4,1068
|
|
31
|
+
polyapi_python-0.3.16.dist-info/METADATA,sha256=6cpwjHGYw4FUgfcoCI_isd-JYAm52BZDzr-KrqST1qs,5923
|
|
32
|
+
polyapi_python-0.3.16.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
33
|
+
polyapi_python-0.3.16.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
|
|
34
|
+
polyapi_python-0.3.16.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|