polyapi-python 0.3.9.dev5__py3-none-any.whl → 0.3.9.dev6__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 CHANGED
@@ -1,10 +1,13 @@
1
1
  from typing import Dict, Optional
2
2
  import requests
3
3
  import os
4
+ import logging
4
5
  from requests import Response
5
6
  from polyapi.config import get_api_key_and_url, get_mtls_config
6
7
  from polyapi.exceptions import PolyApiException
7
8
 
9
+ logger = logging.getLogger("poly")
10
+
8
11
  def direct_execute(function_type, function_id, data) -> Response:
9
12
  """ execute a specific function id/type
10
13
  """
@@ -46,7 +49,7 @@ def direct_execute(function_type, function_id, data) -> Response:
46
49
  if (resp.status_code < 200 or resp.status_code >= 300):
47
50
  error_content = resp.content.decode("utf-8", errors="ignore")
48
51
  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}")
52
+ logger.error(f"Error executing api function with id: {function_id}. Status code: {resp.status_code}. Request data: {data}, Response: {error_content}")
50
53
  elif function_type != 'api':
51
54
  raise PolyApiException(f"{resp.status_code}: {error_content}")
52
55
 
@@ -70,7 +73,7 @@ def execute(function_type, function_id, data) -> Response:
70
73
  if (resp.status_code < 200 or resp.status_code >= 300) and os.getenv("LOGS_ENABLED"):
71
74
  error_content = resp.content.decode("utf-8", errors="ignore")
72
75
  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}")
76
+ logger.error(f"Error executing api function with id: {function_id}. Status code: {resp.status_code}. Request data: {data}, Response: {error_content}")
74
77
  elif function_type != 'api':
75
78
  raise PolyApiException(f"{resp.status_code}: {error_content}")
76
79
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyapi-python
3
- Version: 0.3.9.dev5
3
+ Version: 0.3.9.dev6
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
@@ -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=QAioIrfGUQ5D5DgN6V9QgSLanow1FSu8zbe0_hLeoJk,4392
12
+ polyapi/execute.py,sha256=q4xtV6rYO8f-8hULlFTlVgoTVQSahvlMu3FHkFzYpMs,4423
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.dev5.dist-info/licenses/LICENSE,sha256=6b_I7aPVp8JXhqQwdw7_B84Ca0S4JGjHj0sr_1VOdB4,1068
28
- polyapi_python-0.3.9.dev5.dist-info/METADATA,sha256=qMk0Izatt5FodKxwemqoFxOClAc1KCTDJBfmiDWaDQM,5784
29
- polyapi_python-0.3.9.dev5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
- polyapi_python-0.3.9.dev5.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
31
- polyapi_python-0.3.9.dev5.dist-info/RECORD,,
27
+ polyapi_python-0.3.9.dev6.dist-info/licenses/LICENSE,sha256=6b_I7aPVp8JXhqQwdw7_B84Ca0S4JGjHj0sr_1VOdB4,1068
28
+ polyapi_python-0.3.9.dev6.dist-info/METADATA,sha256=nWRTmjCS4ioIpVJZC5-U6Xg_4CbdPV_oELg1e1DOLTk,5784
29
+ polyapi_python-0.3.9.dev6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
+ polyapi_python-0.3.9.dev6.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
31
+ polyapi_python-0.3.9.dev6.dist-info/RECORD,,