polyapi-python 0.3.9.dev1__py3-none-any.whl → 0.3.9.dev3__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/deployables.py CHANGED
@@ -118,13 +118,13 @@ def get_all_deployable_files_windows(config: PolyDeployConfig) -> List[str]:
118
118
  pattern = ' '.join(f"/C:\"polyConfig: {name}\"" for name in config["type_names"]) or '/C:"polyConfig"'
119
119
 
120
120
  exclude_command = f" | findstr /V /I \"{exclude_pattern}\"" if exclude_pattern else ''
121
- search_command = f" | findstr /S /M /I /F:/ {pattern} *.*"
121
+ search_command = f" | findstr /M /I /F:/ {pattern}"
122
122
 
123
123
  result = []
124
124
  for dir_path in config["include_dirs"]:
125
125
  if dir_path != '.':
126
126
  include_pattern = " ".join(f"{dir_path}*.{f}" for f in config["include_files_or_extensions"]) or "*"
127
- dir_command = f"dir {include_pattern} /S /P /B > NUL"
127
+ dir_command = f"dir {include_pattern} /S /P /B"
128
128
  full_command = f"{dir_command}{exclude_command}{search_command}"
129
129
  try:
130
130
  output = subprocess.check_output(full_command, shell=True, text=True)
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
- raise PolyApiException(f"{endpoint_info.status_code}: {endpoint_info.content.decode('utf-8', errors='ignore')}")
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
- raise PolyApiException(f"{resp.status_code}: {error_content}")
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
- raise PolyApiException(f"{resp.status_code}: {error_content}")
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
 
polyapi/prepare.py CHANGED
@@ -138,11 +138,13 @@ def prepare_deployables(lazy: bool = False, disable_docs: bool = False, disable_
138
138
  write_updated_deployable(deployable, disable_docs)
139
139
  # Re-stage any updated staged files.
140
140
  staged = subprocess.check_output('git diff --name-only --cached', shell=True, text=True, ).split('\n')
141
+ rootPath = subprocess.check_output('git rev-parse --show-toplevel', shell=True, text=True).replace('\n', '')
141
142
  for deployable in dirty_deployables:
142
143
  try:
143
- if deployable["file"] in staged:
144
- print(f'Staging {deployable["file"]}')
145
- subprocess.run(['git', 'add', deployable["file"]])
144
+ deployableName = deployable["file"].replace('\\', '/').replace(f"{rootPath}/", '')
145
+ if deployableName in staged:
146
+ print(f'Staging {deployableName}')
147
+ subprocess.run(['git', 'add', deployableName])
146
148
  except:
147
149
  print('Warning: File staging failed, check that all files are staged properly.')
148
150
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyapi-python
3
- Version: 0.3.9.dev1
3
+ Version: 0.3.9.dev3
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
@@ -6,15 +6,15 @@ polyapi/cli.py,sha256=unKqAoZ1hTGAeyYRfNQ6jO15Um7N4F95k__1qFue5bI,10659
6
6
  polyapi/client.py,sha256=DW6ljG_xCwAo2yz23A9QfLooE6ZUDvSpdA4e_dCQjiQ,1418
7
7
  polyapi/config.py,sha256=cAMv2n9tGN_BTvqt7V32o5F86qRhxAKyey_PoId2D8s,7638
8
8
  polyapi/constants.py,sha256=sc-FnS0SngBLvSu1ZWMs0UCf9EYD1u1Yhfr-sZXGLns,607
9
- polyapi/deployables.py,sha256=8x-Y7MlpWnTqsWhidmO6yVZe2nTChzma6hJNVsfg94s,12113
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=sjI6BMBYPSCD6UngV9DzpJIRSU6p02aShNaTXhDExtY,3457
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
16
16
  polyapi/poly_schemas.py,sha256=fZ6AGvHcOKQJtlrzSuzeBNed5DxPMA2dJGdJvuFCHWM,9066
17
- polyapi/prepare.py,sha256=pRWBhpgqMtKP04P9F6PIA3eCkOpCxQSv9TZdR3qR34I,7216
17
+ polyapi/prepare.py,sha256=NQzpMIoakNovStvOGOmqSYIpTwiWXaweNSE9se10A2E,7420
18
18
  polyapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  polyapi/rendered_spec.py,sha256=nJEj2vRgG3N20fU4s-ThRtOIwAuTzXwXuOBIkXljDVc,2240
20
20
  polyapi/schema.py,sha256=-mtRV5iL3CV0X3phXhGYFV8sLz0KouTACOKWyGO9Pwc,5309
@@ -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.dev1.dist-info/licenses/LICENSE,sha256=6b_I7aPVp8JXhqQwdw7_B84Ca0S4JGjHj0sr_1VOdB4,1068
28
- polyapi_python-0.3.9.dev1.dist-info/METADATA,sha256=W5sXQ5iF_6nU9kdOkYyklEaVVBuG6F3N9nzlv4xhfUk,5784
29
- polyapi_python-0.3.9.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
- polyapi_python-0.3.9.dev1.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
31
- polyapi_python-0.3.9.dev1.dist-info/RECORD,,
27
+ polyapi_python-0.3.9.dev3.dist-info/licenses/LICENSE,sha256=6b_I7aPVp8JXhqQwdw7_B84Ca0S4JGjHj0sr_1VOdB4,1068
28
+ polyapi_python-0.3.9.dev3.dist-info/METADATA,sha256=cbebN9zVLGi1vsUCUTonVznBUG6heRJjSWS2LEpYEGo,5784
29
+ polyapi_python-0.3.9.dev3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
+ polyapi_python-0.3.9.dev3.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
31
+ polyapi_python-0.3.9.dev3.dist-info/RECORD,,