polyapi-python 0.2.5.dev4__py3-none-any.whl → 0.2.5.dev5__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/rendered_spec.py CHANGED
@@ -3,11 +3,10 @@ from typing import Dict, Optional
3
3
  import requests
4
4
  from polyapi.config import get_api_key_and_url
5
5
  from polyapi.generate import read_cached_specs, render_spec
6
- from polyapi.execute import execute_post
7
6
  from polyapi.typedefs import SpecificationDto
8
7
 
9
8
 
10
- def update_rendered_spec(spec: SpecificationDto):
9
+ def update_rendered_spec(api_key: str, spec: SpecificationDto):
11
10
  print("Updating rendered spec...")
12
11
  func_str, type_defs = render_spec(spec)
13
12
  data = {
@@ -23,7 +22,10 @@ def update_rendered_spec(spec: SpecificationDto):
23
22
  raise NotImplementedError("todo")
24
23
 
25
24
  # use super key on develop-k8s here!
26
- resp = execute_post("/functions/rendered-specs", data)
25
+ _, base_url = get_api_key_and_url()
26
+ url = f"{base_url}/functions/rendered-specs"
27
+ headers = {"Authorization": f"Bearer {api_key}"}
28
+ resp = requests.post(url, json=data, headers=headers)
27
29
  assert resp.status_code == 201, (resp.text, resp.status_code)
28
30
  # this needs to run with something like `kn func run...`
29
31
 
@@ -46,7 +48,7 @@ def _get_spec(api_key: str, spec_id: str) -> Optional[SpecificationDto]:
46
48
  def get_and_update_rendered_spec(api_key: str, spec_id: str) -> bool:
47
49
  spec = _get_spec(api_key, spec_id)
48
50
  if spec:
49
- update_rendered_spec(spec)
51
+ update_rendered_spec(api_key, spec)
50
52
  return True
51
53
  return False
52
54
 
@@ -58,4 +60,4 @@ def save_rendered_specs() -> None:
58
60
  for spec in api_specs:
59
61
  assert spec["function"]
60
62
  print("adding", spec["context"], spec["name"])
61
- update_rendered_spec(spec)
63
+ update_rendered_spec("FIXME", spec)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: polyapi-python
3
- Version: 0.2.5.dev4
3
+ Version: 0.2.5.dev5
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
@@ -12,15 +12,15 @@ polyapi/execute.py,sha256=kXnvlNQ7nz9cRlV2_5gXH09UCmyiDP5zi3wiAw0uDuk,1943
12
12
  polyapi/function_cli.py,sha256=4G4xqDCF7HSVERXRJx1D3uytNI1_mhaU-bNFeNRsQ3E,9231
13
13
  polyapi/generate.py,sha256=dtS6Wyb_lq9FrOs7NA_ceKCX9rogx2_3Fp57_hGwdDc,7957
14
14
  polyapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- polyapi/rendered_spec.py,sha256=aUy06fPt2Yusx1y6Q2Xj6XQpUMz466jWXgWsS2af3Do,1958
15
+ polyapi/rendered_spec.py,sha256=1jRiV4P5qUH8NAO2CSD4TvgTEV149jHyOqLxQKthpwM,2090
16
16
  polyapi/schema.py,sha256=VQl3YJNiejShAcgPHq3IyRMiwpVEy52Jq5alB-65udg,2956
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=CXzQC5u8vNMyS7f3E45plSuB2EodevDmkOXhHA2zxoc,7108
20
20
  polyapi/variables.py,sha256=d36-trnfTL_8m2NkorMiImb4O3UrJbiFV38CHxV5i0A,4200
21
21
  polyapi/webhook.py,sha256=GvnS49Vl4k5STTvv4KKUnUAyn27OhIHHXChFmiI53Cs,4849
22
- polyapi_python-0.2.5.dev4.dist-info/LICENSE,sha256=Hi0kDr56Dsy0uYIwNt4r9G7tI8x8miXRTlyvbeplCP8,1068
23
- polyapi_python-0.2.5.dev4.dist-info/METADATA,sha256=r_I3w5URADWnjHnUaBEi9v6vqNYTYSnS_wVa2-ArOj4,4867
24
- polyapi_python-0.2.5.dev4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
25
- polyapi_python-0.2.5.dev4.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
26
- polyapi_python-0.2.5.dev4.dist-info/RECORD,,
22
+ polyapi_python-0.2.5.dev5.dist-info/LICENSE,sha256=Hi0kDr56Dsy0uYIwNt4r9G7tI8x8miXRTlyvbeplCP8,1068
23
+ polyapi_python-0.2.5.dev5.dist-info/METADATA,sha256=-b787MldneWyey4k2WYmgDBgqIr-zl2zhF0fZ0sciIM,4867
24
+ polyapi_python-0.2.5.dev5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
25
+ polyapi_python-0.2.5.dev5.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
26
+ polyapi_python-0.2.5.dev5.dist-info/RECORD,,