polyapi-python 0.2.6.dev1__py3-none-any.whl → 0.2.7.dev0__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 CHANGED
@@ -45,8 +45,8 @@ def execute_from_cli() -> None:
45
45
  clear_config()
46
46
  generate()
47
47
  elif command == "update_rendered_spec":
48
- assert len(args.subcommands) == 2
49
- updated = get_and_update_rendered_spec(args.subcommands[0], args.subcommands[1])
48
+ assert len(args.subcommands) == 1
49
+ updated = get_and_update_rendered_spec(args.subcommands[0])
50
50
  if updated:
51
51
  print("Updated rendered spec!")
52
52
  else:
polyapi/rendered_spec.py CHANGED
@@ -7,7 +7,7 @@ from polyapi.generate import read_cached_specs, render_spec
7
7
  from polyapi.typedefs import SpecificationDto
8
8
 
9
9
 
10
- def update_rendered_spec(api_key: str, spec: SpecificationDto):
10
+ def update_rendered_spec(spec: SpecificationDto):
11
11
  print("Updating rendered spec...")
12
12
  func_str, type_defs = render_spec(spec)
13
13
  data = {
@@ -27,9 +27,7 @@ def update_rendered_spec(api_key: str, spec: SpecificationDto):
27
27
  raise NotImplementedError("todo")
28
28
 
29
29
  # use super key on develop-k8s here!
30
- _, base_url = get_api_key_and_url()
31
- if not base_url:
32
- base_url = os.environ.get("HOST_URL")
30
+ api_key, base_url = get_api_key_and_url()
33
31
 
34
32
  url = f"{base_url}/functions/rendered-specs"
35
33
  headers = {"Authorization": f"Bearer {api_key}"}
@@ -37,11 +35,8 @@ def update_rendered_spec(api_key: str, spec: SpecificationDto):
37
35
  assert resp.status_code == 201, (resp.text, resp.status_code)
38
36
 
39
37
 
40
- def _get_spec(api_key: str, spec_id: str) -> Optional[SpecificationDto]:
41
- _, base_url = get_api_key_and_url()
42
- if not base_url:
43
- base_url = os.environ.get("HOST_URL")
44
-
38
+ def _get_spec(spec_id: str) -> Optional[SpecificationDto]:
39
+ api_key, base_url = get_api_key_and_url()
45
40
  url = f"{base_url}/specs"
46
41
  headers = {"Authorization": f"Bearer {api_key}"}
47
42
  resp = requests.get(url, headers=headers)
@@ -55,10 +50,10 @@ def _get_spec(api_key: str, spec_id: str) -> Optional[SpecificationDto]:
55
50
  raise NotImplementedError(resp.content)
56
51
 
57
52
 
58
- def get_and_update_rendered_spec(api_key: str, spec_id: str) -> bool:
59
- spec = _get_spec(api_key, spec_id)
53
+ def get_and_update_rendered_spec(spec_id: str) -> bool:
54
+ spec = _get_spec(spec_id)
60
55
  if spec:
61
- update_rendered_spec(api_key, spec)
56
+ update_rendered_spec(spec)
62
57
  return True
63
58
  return False
64
59
 
@@ -70,4 +65,4 @@ def save_rendered_specs() -> None:
70
65
  for spec in api_specs:
71
66
  assert spec["function"]
72
67
  print("adding", spec["context"], spec["name"])
73
- update_rendered_spec("FIXME", spec)
68
+ update_rendered_spec(spec)
polyapi/schema.py CHANGED
@@ -77,20 +77,6 @@ def generate_schema_types(input_data: Dict, root=None):
77
77
  with open(tmp_output) as f:
78
78
  output = f.read()
79
79
 
80
- output = _fix_title(input_data, output)
81
- return output
82
-
83
-
84
- def _fix_title(input_data, output) -> str:
85
- """ the jsonschema_gentypes library changes all titles to Pascalcase
86
- this function changes them back
87
- TODO fix bug in gentypes so this step is not necessary
88
- """
89
- for k, v in input_data.items():
90
- if isinstance(v, dict):
91
- output = _fix_title(v, output)
92
- elif k == "title":
93
- output = output.replace(f"class {v.title()}", f"class {v}")
94
80
  return output
95
81
 
96
82
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: polyapi-python
3
- Version: 0.2.6.dev1
3
+ Version: 0.2.7.dev0
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
@@ -2,7 +2,7 @@ polyapi/__init__.py,sha256=5iujRodfgRyLxT-zY0L3xax3rKRvfSt4NZlZYKOz03w,608
2
2
  polyapi/__main__.py,sha256=V4zhAh_YGxno5f_KSrlkELxcuDh9bR3WSd0n-2r-qQQ,93
3
3
  polyapi/api.py,sha256=bE651P47RuhqNYkVyvTH_pA44JypRZED_2M5UG_qzDI,1863
4
4
  polyapi/auth.py,sha256=zrIGatjba5GwUTNjKj1GHQWTEDP9B-HrSzCKbLFoqvc,5336
5
- polyapi/cli.py,sha256=ZiOkD9DmlixxPvxfk1JQGoQwXv9Zf2cxk-J1ZMZN6IA,2657
5
+ polyapi/cli.py,sha256=XvsE5QEJZpobISVN2U0Mi-fC1nN8dmXF7AQOIpjUe-A,2636
6
6
  polyapi/client.py,sha256=w15XOABkwdL4V4r2iWY_nypzLjvoKVuux8jUKbA16pQ,1329
7
7
  polyapi/config.py,sha256=S8TU10upy5OW1_vX-CqQTJD-ZOB6329aMjiUCmukfUI,2292
8
8
  polyapi/constants.py,sha256=sc-FnS0SngBLvSu1ZWMs0UCf9EYD1u1Yhfr-sZXGLns,607
@@ -12,15 +12,15 @@ polyapi/execute.py,sha256=kXnvlNQ7nz9cRlV2_5gXH09UCmyiDP5zi3wiAw0uDuk,1943
12
12
  polyapi/function_cli.py,sha256=NE8CT1E22PC5DorVWJefXsBBGUnpSIsUyhHla02SV4k,9193
13
13
  polyapi/generate.py,sha256=LN2Z6fE-HfpMsXlkJfOl8bqZdR3fUythE_ZsAe15tmk,8012
14
14
  polyapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- polyapi/rendered_spec.py,sha256=JIsFkqAhYEtKa3-ToTli_th_wLbJpxgr_eYOMz4Z7yY,2345
16
- polyapi/schema.py,sha256=qxzuWhpDLyO4eGutiaWHGVL9sT46-kVE3r4xByIwGVI,3662
15
+ polyapi/rendered_spec.py,sha256=uaNzBhP4cX7iGfKwzZv0dxMagWzsGeDr0cQYx_AyIhQ,2153
16
+ polyapi/schema.py,sha256=VVMHAT5yU47cRC7xF44BrmUSemlk5oIKSxH2HTVPaQ8,3169
17
17
  polyapi/server.py,sha256=n-nMGjXoq9T9ZwE2EBDkAaxJ7UytConGaHthkjbkCXA,1894
18
18
  polyapi/typedefs.py,sha256=mRqwd2LKofxNn_VSKxBzixni2j-tai8mfTQ0Wi2aLNM,1487
19
19
  polyapi/utils.py,sha256=JtL_v0PVkJBlTeRu0gIV5IDScqoiggS8m-VcS4HN22c,6890
20
20
  polyapi/variables.py,sha256=d36-trnfTL_8m2NkorMiImb4O3UrJbiFV38CHxV5i0A,4200
21
21
  polyapi/webhook.py,sha256=LWv28c2MLz_OKBI_Nn7WR4C-gs1SWgbdXsoxIIf-9UI,4886
22
- polyapi_python-0.2.6.dev1.dist-info/LICENSE,sha256=Hi0kDr56Dsy0uYIwNt4r9G7tI8x8miXRTlyvbeplCP8,1068
23
- polyapi_python-0.2.6.dev1.dist-info/METADATA,sha256=98yrjJMCmcYSHOsXQ-JY2OY_Tah6CPDr3vHNfAuoObM,4867
24
- polyapi_python-0.2.6.dev1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
25
- polyapi_python-0.2.6.dev1.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
26
- polyapi_python-0.2.6.dev1.dist-info/RECORD,,
22
+ polyapi_python-0.2.7.dev0.dist-info/LICENSE,sha256=Hi0kDr56Dsy0uYIwNt4r9G7tI8x8miXRTlyvbeplCP8,1068
23
+ polyapi_python-0.2.7.dev0.dist-info/METADATA,sha256=c3GVRE1pr450qHhFlLGBCspXxps3NdbN3ExVTDYqQOk,4867
24
+ polyapi_python-0.2.7.dev0.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
25
+ polyapi_python-0.2.7.dev0.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
26
+ polyapi_python-0.2.7.dev0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (70.1.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5