polyapi-python 0.3.4__py3-none-any.whl → 0.3.4.dev2__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/cli.py +2 -1
- polyapi/execute.py +1 -5
- polyapi/generate.py +5 -4
- polyapi/rendered_spec.py +3 -2
- {polyapi_python-0.3.4.dist-info → polyapi_python-0.3.4.dev2.dist-info}/METADATA +1 -1
- {polyapi_python-0.3.4.dist-info → polyapi_python-0.3.4.dev2.dist-info}/RECORD +9 -9
- {polyapi_python-0.3.4.dist-info → polyapi_python-0.3.4.dev2.dist-info}/WHEEL +0 -0
- {polyapi_python-0.3.4.dist-info → polyapi_python-0.3.4.dev2.dist-info}/licenses/LICENSE +0 -0
- {polyapi_python-0.3.4.dist-info → polyapi_python-0.3.4.dev2.dist-info}/top_level.txt +0 -0
polyapi/cli.py
CHANGED
|
@@ -44,10 +44,11 @@ def execute_from_cli():
|
|
|
44
44
|
###########################################################################
|
|
45
45
|
# Generate command
|
|
46
46
|
generate_parser = subparsers.add_parser("generate", help="Generates Poly library")
|
|
47
|
+
generate_parser.add_argument("--no-types", action="store_true", help="Generate SDK without type definitions")
|
|
47
48
|
|
|
48
49
|
def generate_command(args):
|
|
49
50
|
initialize_config()
|
|
50
|
-
generate()
|
|
51
|
+
generate(no_types=args.no_types)
|
|
51
52
|
|
|
52
53
|
generate_parser.set_defaults(command=generate_command)
|
|
53
54
|
|
polyapi/execute.py
CHANGED
|
@@ -8,14 +8,10 @@ from polyapi.exceptions import PolyApiException
|
|
|
8
8
|
def execute(function_type, function_id, data) -> Response:
|
|
9
9
|
""" execute a specific function id/type
|
|
10
10
|
"""
|
|
11
|
-
data_without_None = data
|
|
12
|
-
if isinstance(data, Dict):
|
|
13
|
-
data_without_None = {k: v for k, v in data.items() if v is not None}
|
|
14
|
-
|
|
15
11
|
api_key, api_url = get_api_key_and_url()
|
|
16
12
|
headers = {"Authorization": f"Bearer {api_key}"}
|
|
17
13
|
url = f"{api_url}/functions/{function_type}/{function_id}/execute"
|
|
18
|
-
resp = requests.post(url, json=
|
|
14
|
+
resp = requests.post(url, json=data, headers=headers)
|
|
19
15
|
# print(resp.status_code)
|
|
20
16
|
# print(resp.headers["content-type"])
|
|
21
17
|
if resp.status_code < 200 or resp.status_code >= 300:
|
polyapi/generate.py
CHANGED
|
@@ -36,12 +36,13 @@ Unresolved schema, please add the following schema to complete it:
|
|
|
36
36
|
path:'''
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
def get_specs() -> List:
|
|
39
|
+
def get_specs(no_types: bool = False) -> List:
|
|
40
40
|
api_key, api_url = get_api_key_and_url()
|
|
41
41
|
assert api_key
|
|
42
42
|
headers = get_auth_headers(api_key)
|
|
43
43
|
url = f"{api_url}/specs"
|
|
44
|
-
|
|
44
|
+
params = {"noTypes": str(no_types).lower()}
|
|
45
|
+
resp = requests.get(url, headers=headers, params=params)
|
|
45
46
|
if resp.status_code == 200:
|
|
46
47
|
return resp.json()
|
|
47
48
|
else:
|
|
@@ -196,11 +197,11 @@ def remove_old_library():
|
|
|
196
197
|
shutil.rmtree(path)
|
|
197
198
|
|
|
198
199
|
|
|
199
|
-
def generate() -> None:
|
|
200
|
+
def generate(no_types: bool = False) -> None:
|
|
200
201
|
print("Generating Poly Python SDK...", end="", flush=True)
|
|
201
202
|
remove_old_library()
|
|
202
203
|
|
|
203
|
-
specs = get_specs()
|
|
204
|
+
specs = get_specs(no_types=no_types)
|
|
204
205
|
cache_specs(specs)
|
|
205
206
|
|
|
206
207
|
limit_ids: List[str] = [] # useful for narrowing down generation to a single function to debug
|
polyapi/rendered_spec.py
CHANGED
|
@@ -35,11 +35,12 @@ def update_rendered_spec(spec: SpecificationDto):
|
|
|
35
35
|
assert resp.status_code == 201, (resp.text, resp.status_code)
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
def _get_spec(spec_id: str) -> Optional[SpecificationDto]:
|
|
38
|
+
def _get_spec(spec_id: str, no_types: bool = False) -> Optional[SpecificationDto]:
|
|
39
39
|
api_key, base_url = get_api_key_and_url()
|
|
40
40
|
url = f"{base_url}/specs"
|
|
41
41
|
headers = {"Authorization": f"Bearer {api_key}"}
|
|
42
|
-
|
|
42
|
+
params = {"noTypes": str(no_types).lower()}
|
|
43
|
+
resp = requests.get(url, headers=headers, params=params)
|
|
43
44
|
if resp.status_code == 200:
|
|
44
45
|
specs = resp.json()
|
|
45
46
|
for spec in specs:
|
|
@@ -2,21 +2,21 @@ polyapi/__init__.py,sha256=a1Poy1kaTncYnUg6nWRcTjVm-R1CUQk12UX7VYQ9d5k,616
|
|
|
2
2
|
polyapi/__main__.py,sha256=V4zhAh_YGxno5f_KSrlkELxcuDh9bR3WSd0n-2r-qQQ,93
|
|
3
3
|
polyapi/api.py,sha256=f1037HFJF7DtQSSypM4PE5AmmxWxjd0JiW6ARZqrgac,1879
|
|
4
4
|
polyapi/auth.py,sha256=zrIGatjba5GwUTNjKj1GHQWTEDP9B-HrSzCKbLFoqvc,5336
|
|
5
|
-
polyapi/cli.py,sha256=
|
|
5
|
+
polyapi/cli.py,sha256=EVT_mgmaXP4NSk4v3Nr9d5AmeMFEcwVYSk2LNwv7bUs,8375
|
|
6
6
|
polyapi/client.py,sha256=CoFDYvyKsqL4wPQbUDIr0Qb8Q5eD92xN4OEEcJEVuGQ,1296
|
|
7
7
|
polyapi/config.py,sha256=Vgc_q9FYXWGCOTr13EbpD0AwHks0Nflimy1NtZxgynA,3088
|
|
8
8
|
polyapi/constants.py,sha256=sc-FnS0SngBLvSu1ZWMs0UCf9EYD1u1Yhfr-sZXGLns,607
|
|
9
9
|
polyapi/deployables.py,sha256=WVcNNB6W5ZW_-ukf_kK3moRcnwIkC-O4te6vLepjcco,11936
|
|
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=akfiJMIlRCPNtDfRvGd11baGC7F8gjwD3Uv8w9RVND4,1967
|
|
13
13
|
polyapi/function_cli.py,sha256=htgmcx_dPmw4_5NKRgIivcwS7D8bkOsxCTOrJhzV3pU,3989
|
|
14
|
-
polyapi/generate.py,sha256=
|
|
14
|
+
polyapi/generate.py,sha256=SIWyl7sZjRL33xViQvIo5adVsE5R9epuOF9rSB-audU,11638
|
|
15
15
|
polyapi/parser.py,sha256=mdoh4pNq8pyiHE0-i6Coqj8frEXfBLRk6itpAXMrrgI,20373
|
|
16
16
|
polyapi/poly_schemas.py,sha256=T4kfZyfgVLiqLD28GmYNiHnrNx77J_HO4uzk8LUAhlo,3137
|
|
17
17
|
polyapi/prepare.py,sha256=Q8CWV4kmZ2dbXYVsud34AgJkj5ymcQ_IcYhLuikc9yk,6659
|
|
18
18
|
polyapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
-
polyapi/rendered_spec.py,sha256=
|
|
19
|
+
polyapi/rendered_spec.py,sha256=nJEj2vRgG3N20fU4s-ThRtOIwAuTzXwXuOBIkXljDVc,2240
|
|
20
20
|
polyapi/schema.py,sha256=ZSzeUjpqigLvE4tFKB7y4AaZG-W5N5Z9wMH-F-vjMBU,4616
|
|
21
21
|
polyapi/server.py,sha256=YXWxhYBx-hluwDQ8Jvfpy2s8ogz0GsNTMcZVNcP5ca8,2147
|
|
22
22
|
polyapi/sync.py,sha256=PGdC0feBBjEVrF3d9EluW_OAxbWuzSrfh84czma8kWg,6476
|
|
@@ -24,8 +24,8 @@ polyapi/typedefs.py,sha256=KniVl7vwcDOhgAJmHSgTJKkP0rKWvSLIPOGsWuf9jRU,2239
|
|
|
24
24
|
polyapi/utils.py,sha256=K6QMKEf2fgmh3AswyNBADfv53sIOSAbXmGx2MaW5vy8,10261
|
|
25
25
|
polyapi/variables.py,sha256=d36-trnfTL_8m2NkorMiImb4O3UrJbiFV38CHxV5i0A,4200
|
|
26
26
|
polyapi/webhook.py,sha256=LWv28c2MLz_OKBI_Nn7WR4C-gs1SWgbdXsoxIIf-9UI,4886
|
|
27
|
-
polyapi_python-0.3.4.dist-info/licenses/LICENSE,sha256=6b_I7aPVp8JXhqQwdw7_B84Ca0S4JGjHj0sr_1VOdB4,1068
|
|
28
|
-
polyapi_python-0.3.4.dist-info/METADATA,sha256=
|
|
29
|
-
polyapi_python-0.3.4.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
|
30
|
-
polyapi_python-0.3.4.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
|
|
31
|
-
polyapi_python-0.3.4.dist-info/RECORD,,
|
|
27
|
+
polyapi_python-0.3.4.dev2.dist-info/licenses/LICENSE,sha256=6b_I7aPVp8JXhqQwdw7_B84Ca0S4JGjHj0sr_1VOdB4,1068
|
|
28
|
+
polyapi_python-0.3.4.dev2.dist-info/METADATA,sha256=RjB5UQgq8Ig7RkiRW5lC5e_UOh5kDeHe5fTjaZpGooU,5782
|
|
29
|
+
polyapi_python-0.3.4.dev2.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
|
30
|
+
polyapi_python-0.3.4.dev2.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
|
|
31
|
+
polyapi_python-0.3.4.dev2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|