polyapi-python 0.3.9.dev2__py3-none-any.whl → 0.3.9.dev4__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/execute.py +16 -5
- {polyapi_python-0.3.9.dev2.dist-info → polyapi_python-0.3.9.dev4.dist-info}/METADATA +2 -2
- {polyapi_python-0.3.9.dev2.dist-info → polyapi_python-0.3.9.dev4.dist-info}/RECORD +6 -6
- {polyapi_python-0.3.9.dev2.dist-info → polyapi_python-0.3.9.dev4.dist-info}/WHEEL +0 -0
- {polyapi_python-0.3.9.dev2.dist-info → polyapi_python-0.3.9.dev4.dist-info}/licenses/LICENSE +0 -0
- {polyapi_python-0.3.9.dev2.dist-info → polyapi_python-0.3.9.dev4.dist-info}/top_level.txt +0 -0
polyapi/execute.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from typing import Dict, Optional
|
|
2
2
|
import requests
|
|
3
|
+
import os
|
|
3
4
|
from requests import Response
|
|
4
5
|
from polyapi.config import get_api_key_and_url, get_mtls_config
|
|
5
6
|
from polyapi.exceptions import PolyApiException
|
|
@@ -13,7 +14,11 @@ def direct_execute(function_type, function_id, data) -> Response:
|
|
|
13
14
|
|
|
14
15
|
endpoint_info = requests.post(url, json=data, headers=headers)
|
|
15
16
|
if endpoint_info.status_code < 200 or endpoint_info.status_code >= 300:
|
|
16
|
-
|
|
17
|
+
error_content = endpoint_info.content.decode("utf-8", errors="ignore")
|
|
18
|
+
if function_type == 'api' and os.getenv("LOGS_ENABLED"):
|
|
19
|
+
raise PolyApiException(f"Error executing api function with id: {function_id}. Status code: {endpoint_info.status_code}. Request data: {data}, Response: {error_content}")
|
|
20
|
+
elif function_type != 'api':
|
|
21
|
+
raise PolyApiException(f"{endpoint_info.status_code}: {error_content}")
|
|
17
22
|
|
|
18
23
|
endpoint_info_data = endpoint_info.json()
|
|
19
24
|
request_params = endpoint_info_data.copy()
|
|
@@ -38,9 +43,12 @@ def direct_execute(function_type, function_id, data) -> Response:
|
|
|
38
43
|
**request_params
|
|
39
44
|
)
|
|
40
45
|
|
|
41
|
-
if resp.status_code < 200 or resp.status_code >= 300:
|
|
46
|
+
if (resp.status_code < 200 or resp.status_code >= 300):
|
|
42
47
|
error_content = resp.content.decode("utf-8", errors="ignore")
|
|
43
|
-
|
|
48
|
+
if function_type == 'api' and os.getenv("LOGS_ENABLED"):
|
|
49
|
+
raise PolyApiException(f"Error executing api function with id: {function_id}. Status code: {resp.status_code}. Request data: {data}, Response: {error_content}")
|
|
50
|
+
elif function_type != 'api':
|
|
51
|
+
raise PolyApiException(f"{resp.status_code}: {error_content}")
|
|
44
52
|
|
|
45
53
|
return resp
|
|
46
54
|
|
|
@@ -59,9 +67,12 @@ def execute(function_type, function_id, data) -> Response:
|
|
|
59
67
|
headers=headers,
|
|
60
68
|
)
|
|
61
69
|
|
|
62
|
-
if resp.status_code < 200 or resp.status_code >= 300:
|
|
70
|
+
if (resp.status_code < 200 or resp.status_code >= 300) and os.getenv("LOGS_ENABLED"):
|
|
63
71
|
error_content = resp.content.decode("utf-8", errors="ignore")
|
|
64
|
-
|
|
72
|
+
if function_type == 'api' and os.getenv("LOGS_ENABLED"):
|
|
73
|
+
raise PolyApiException(f"Error executing api function with id: {function_id}. Status code: {resp.status_code}. Request data: {data}, Response: {error_content}")
|
|
74
|
+
elif function_type != 'api':
|
|
75
|
+
raise PolyApiException(f"{resp.status_code}: {error_content}")
|
|
65
76
|
|
|
66
77
|
return resp
|
|
67
78
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: polyapi-python
|
|
3
|
-
Version: 0.3.9.
|
|
3
|
+
Version: 0.3.9.dev4
|
|
4
4
|
Summary: The Python Client for PolyAPI, the IPaaS by Developers for Developers
|
|
5
5
|
Author-email: Dan Fellin <dan@polyapi.io>
|
|
6
6
|
License: MIT License
|
|
@@ -32,7 +32,7 @@ Requires-Dist: requests>=2.32.3
|
|
|
32
32
|
Requires-Dist: typing_extensions>=4.12.2
|
|
33
33
|
Requires-Dist: jsonschema-gentypes==2.6.0
|
|
34
34
|
Requires-Dist: pydantic>=2.8.0
|
|
35
|
-
Requires-Dist: stdlib_list
|
|
35
|
+
Requires-Dist: stdlib_list>=0.10.0
|
|
36
36
|
Requires-Dist: colorama==0.4.4
|
|
37
37
|
Requires-Dist: python-socketio[asyncio_client]==5.11.1
|
|
38
38
|
Requires-Dist: truststore==0.8.0
|
|
@@ -9,7 +9,7 @@ polyapi/constants.py,sha256=sc-FnS0SngBLvSu1ZWMs0UCf9EYD1u1Yhfr-sZXGLns,607
|
|
|
9
9
|
polyapi/deployables.py,sha256=vaZvdkPpwgjVtRXD4IxFsJ90Qmgs-AOIB3ygy4QCG78,12100
|
|
10
10
|
polyapi/error_handler.py,sha256=I_e0iz6VM23FLVQWJljxs2NGcl_OODbi43OcbnqBlp8,2398
|
|
11
11
|
polyapi/exceptions.py,sha256=Zh7i7eCUhDuXEdUYjatkLFTeZkrx1BJ1P5ePgbJ9eIY,89
|
|
12
|
-
polyapi/execute.py,sha256=
|
|
12
|
+
polyapi/execute.py,sha256=QAioIrfGUQ5D5DgN6V9QgSLanow1FSu8zbe0_hLeoJk,4392
|
|
13
13
|
polyapi/function_cli.py,sha256=H0sVrbvRBXw_xeApe2MvQw8p_xE7jVTTOU-07Dg041A,4220
|
|
14
14
|
polyapi/generate.py,sha256=slCw9AOvQHQ8UtEaumFI1NoRvjH2Dj3Y33u7imQqi8c,19521
|
|
15
15
|
polyapi/parser.py,sha256=20ZE7kSXx3UL7QVSIYYxzsnJlygVbsaDAg9q7c41WxQ,20695
|
|
@@ -24,8 +24,8 @@ polyapi/typedefs.py,sha256=vJLZYBNmR3i8yQEDYlu1UfvtJyg6E1R1QyGlgFUm2rU,2362
|
|
|
24
24
|
polyapi/utils.py,sha256=1F7Dwst_PbPuUBUSxx5r8d2DHDgqHtu07QW92T_YSdw,12454
|
|
25
25
|
polyapi/variables.py,sha256=VAp2d5I-4WLYHCPF1w3pqU4-z8_XRQpYW-ddOw6G5S4,7268
|
|
26
26
|
polyapi/webhook.py,sha256=gWYXHz0PnB_uY_lnHeUlg3EIHfTGwF-Tc6UaatldZBw,5333
|
|
27
|
-
polyapi_python-0.3.9.
|
|
28
|
-
polyapi_python-0.3.9.
|
|
29
|
-
polyapi_python-0.3.9.
|
|
30
|
-
polyapi_python-0.3.9.
|
|
31
|
-
polyapi_python-0.3.9.
|
|
27
|
+
polyapi_python-0.3.9.dev4.dist-info/licenses/LICENSE,sha256=6b_I7aPVp8JXhqQwdw7_B84Ca0S4JGjHj0sr_1VOdB4,1068
|
|
28
|
+
polyapi_python-0.3.9.dev4.dist-info/METADATA,sha256=vqbpxxtADS59pnd8tZt9g7FQmsuijejSVMuYa9U8M8k,5784
|
|
29
|
+
polyapi_python-0.3.9.dev4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
30
|
+
polyapi_python-0.3.9.dev4.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
|
|
31
|
+
polyapi_python-0.3.9.dev4.dist-info/RECORD,,
|
|
File without changes
|
{polyapi_python-0.3.9.dev2.dist-info → polyapi_python-0.3.9.dev4.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|