polyapi-python 0.2.5.dev4__tar.gz → 0.2.5.dev6__tar.gz
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_python-0.2.5.dev4/polyapi_python.egg-info → polyapi_python-0.2.5.dev6}/PKG-INFO +1 -1
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/rendered_spec.py +11 -5
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6/polyapi_python.egg-info}/PKG-INFO +1 -1
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/pyproject.toml +1 -1
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/tests/test_rendered_spec.py +3 -3
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/LICENSE +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/README.md +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/__init__.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/__main__.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/api.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/auth.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/cli.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/client.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/config.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/constants.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/error_handler.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/exceptions.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/execute.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/function_cli.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/generate.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/py.typed +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/schema.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/server.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/typedefs.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/utils.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/variables.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi/webhook.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi_python.egg-info/SOURCES.txt +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi_python.egg-info/dependency_links.txt +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi_python.egg-info/requires.txt +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi_python.egg-info/top_level.txt +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/setup.cfg +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/tests/test_api.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/tests/test_auth.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/tests/test_function_cli.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/tests/test_schema.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/tests/test_server.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/tests/test_utils.py +0 -0
- {polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/tests/test_variables.py +0 -0
|
@@ -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,14 @@ def update_rendered_spec(spec: SpecificationDto):
|
|
|
23
22
|
raise NotImplementedError("todo")
|
|
24
23
|
|
|
25
24
|
# use super key on develop-k8s here!
|
|
26
|
-
|
|
25
|
+
_, base_url = get_api_key_and_url()
|
|
26
|
+
if not base_url:
|
|
27
|
+
# local node server runs on port 8000
|
|
28
|
+
base_url = "http://localhost:8000"
|
|
29
|
+
|
|
30
|
+
url = f"{base_url}/functions/rendered-specs"
|
|
31
|
+
headers = {"Authorization": f"Bearer {api_key}"}
|
|
32
|
+
resp = requests.post(url, json=data, headers=headers)
|
|
27
33
|
assert resp.status_code == 201, (resp.text, resp.status_code)
|
|
28
34
|
# this needs to run with something like `kn func run...`
|
|
29
35
|
|
|
@@ -46,7 +52,7 @@ def _get_spec(api_key: str, spec_id: str) -> Optional[SpecificationDto]:
|
|
|
46
52
|
def get_and_update_rendered_spec(api_key: str, spec_id: str) -> bool:
|
|
47
53
|
spec = _get_spec(api_key, spec_id)
|
|
48
54
|
if spec:
|
|
49
|
-
update_rendered_spec(spec)
|
|
55
|
+
update_rendered_spec(api_key, spec)
|
|
50
56
|
return True
|
|
51
57
|
return False
|
|
52
58
|
|
|
@@ -58,4 +64,4 @@ def save_rendered_specs() -> None:
|
|
|
58
64
|
for spec in api_specs:
|
|
59
65
|
assert spec["function"]
|
|
60
66
|
print("adding", spec["context"], spec["name"])
|
|
61
|
-
update_rendered_spec(spec)
|
|
67
|
+
update_rendered_spec("FIXME", spec)
|
|
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"]
|
|
|
3
3
|
|
|
4
4
|
[project]
|
|
5
5
|
name = "polyapi-python"
|
|
6
|
-
version = "0.2.5.
|
|
6
|
+
version = "0.2.5.dev6"
|
|
7
7
|
description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers"
|
|
8
8
|
authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }]
|
|
9
9
|
dependencies = [
|
|
@@ -40,13 +40,13 @@ class T(unittest.TestCase):
|
|
|
40
40
|
self.assertEqual(_get_spec.call_count, 1)
|
|
41
41
|
self.assertFalse(updated)
|
|
42
42
|
|
|
43
|
-
@patch("polyapi.rendered_spec.
|
|
43
|
+
@patch("polyapi.rendered_spec.requests.post")
|
|
44
44
|
@patch("polyapi.rendered_spec._get_spec")
|
|
45
|
-
def test_get_and_update_rendered_spec_success(self, _get_spec,
|
|
45
|
+
def test_get_and_update_rendered_spec_success(self, _get_spec, post):
|
|
46
46
|
""" pass in a bad id to update and make sure it returns False
|
|
47
47
|
"""
|
|
48
48
|
_get_spec.return_value = GET_PRODUCTS_COUNT
|
|
49
|
-
|
|
49
|
+
post.return_value = Mock(status_code=201, text="Created")
|
|
50
50
|
updated = get_and_update_rendered_spec("abc", "123")
|
|
51
51
|
self.assertEqual(_get_spec.call_count, 1)
|
|
52
52
|
self.assertTrue(updated)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi_python.egg-info/requires.txt
RENAMED
|
File without changes
|
{polyapi_python-0.2.5.dev4 → polyapi_python-0.2.5.dev6}/polyapi_python.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|