Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ded8adb
add new dev version
eupharis Mar 28, 2024
9ee4b83
add error_handler
eupharis Apr 8, 2024
1dd6e8e
add error_handler
eupharis Apr 8, 2024
6ce28d4
catch if import name is different than pip name
eupharis Apr 9, 2024
def20b5
lets hardcode pydantic 2.5.3 and see if that fixes
eupharis Apr 9, 2024
cdd9c63
Revert "lets hardcode pydantic 2.5.3 and see if that fixes"
eupharis Apr 9, 2024
395946c
0.2.3.dev4, actually its problem with kube_hunter, nvm
eupharis Apr 9, 2024
5626e58
maybe we need the new requirements
eupharis Apr 9, 2024
bcfe77f
woot client functions are done?
eupharis Apr 11, 2024
6947e87
fix tests
eupharis Apr 11, 2024
a6fe1b4
0.2.3.dev7, dont assume client function, must specify with --client
eupharis Apr 12, 2024
6ffd13d
0.2.3.dev8 fix small bug client functions
eupharis Apr 15, 2024
f10ac61
0.2.3.dev9, add fallbacks if unrecognized version of OpenAPI present …
eupharis Apr 15, 2024
e065e0d
add pyjwt to requirements
eupharis Apr 15, 2024
0d63475
add ability to do multiple error handlers!
eupharis Apr 17, 2024
3a24f7d
dont require pyjwt anymore
eupharis Apr 17, 2024
c9120ef
0.2.4.dev2, replace hacky manual mimetypes with real mimetypes
eupharis Apr 18, 2024
6d5a11e
add polycustom
eupharis Apr 19, 2024
44e63d6
multi webhook (#9)
eupharis Apr 22, 2024
76e4e82
update pyproject.toml
eupharis Apr 22, 2024
d9c79d6
0.2.4.dev5, accept non-200 and non-201 status codes from polyCustom
eupharis Apr 22, 2024
c4f0e5b
0.2.4.dev6 bring python client in line with execute server and consid…
eupharis Apr 22, 2024
3eaab8a
0.2.4.dev7, make TypedDict input and response types more picky if wro…
eupharis Apr 22, 2024
fbf9171
actually use args in webhook
eupharis Apr 23, 2024
60cad53
0.2.4.dev8, fix webhook stopping text
eupharis Apr 23, 2024
ad32f3e
Merge branch 'develop' into better-webhooks
eupharis Apr 23, 2024
39cc2c0
getting there
eupharis Apr 23, 2024
9631e64
0.2.4.dev9, handle already connected error on windows
eupharis Apr 23, 2024
51c33cd
0.2.4.deva1, better user facing messages for webhooks and error handlers
eupharis Apr 23, 2024
e6eff39
woops lets go version 10
eupharis Apr 23, 2024
1fe0b58
0.2.4.dev11
eupharis Apr 23, 2024
a49780e
move polyCustom to own file
eupharis Apr 24, 2024
628bd1f
Merge branch 'develop' into better-webhooks
eupharis Apr 25, 2024
5c66cfa
onward
eupharis Apr 25, 2024
9d8e053
fix it
eupharis Apr 25, 2024
947c07d
wip
eupharis Apr 25, 2024
3b5c03c
Merge branch 'develop' into more-render
eupharis May 8, 2024
8d34db5
next
eupharis May 8, 2024
0bfc7d3
there we go
eupharis May 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion polyapi/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
from polyapi.utils import print_green

from .config import clear_config, set_api_key_and_url
from .generate import generate, clear, save_rendered_specs
from .generate import generate, clear
from .function_cli import function_add_or_update
from .rendered_spec import save_rendered_specs


CLI_COMMANDS = ["setup", "generate", "function", "clear", "help", "save_rendered_specs"]
Expand Down
2 changes: 2 additions & 0 deletions polyapi/function_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from polyapi.generate import get_functions_and_parse, generate_functions
from polyapi.config import get_api_key_and_url
from polyapi.constants import PYTHON_TO_JSONSCHEMA_TYPE_MAP
# from polyapi.rendered_spec import update_rendered_spec
from polyapi.utils import get_auth_headers, print_green, print_red, print_yellow
import importlib

Expand Down Expand Up @@ -270,6 +271,7 @@ def function_add_or_update(
print(f"Function ID: {function_id}")
print("Generating new custom function...", end="")
functions = get_functions_and_parse(limit_ids=[function_id])
# update_rendered_spec(functions[0])
generate_functions(functions)
print_green("DONE")
else:
Expand Down
19 changes: 0 additions & 19 deletions polyapi/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from polyapi.auth import render_auth_function
from polyapi.client import render_client_function
from polyapi.execute import execute_post
from polyapi.webhook import render_webhook_handle

from .typedefs import PropertySpecification, SpecificationDto, VariableSpecDto
Expand Down Expand Up @@ -157,24 +156,6 @@ def clear() -> None:
print("Cleared!")


def save_rendered_specs() -> None:
specs = read_cached_specs()
# right now we just support rendered apiFunctions
api_specs = [spec for spec in specs if spec["type"] == "apiFunction"]
for spec in api_specs:
assert spec["function"]
func_str, type_defs = render_spec(spec)
data = {
"language": "python",
"apiFunctionId": spec["id"],
"signature": func_str,
"typedefs": type_defs,
}
resp = execute_post("/functions/rendered-specs", data)
print("adding", spec["context"], spec["name"])
assert resp.status_code == 201, (resp.text, resp.status_code)


def render_spec(spec: SpecificationDto):
function_type = spec["type"]
function_description = spec["description"]
Expand Down
34 changes: 34 additions & 0 deletions polyapi/rendered_spec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from typing import Dict
from polyapi.generate import read_cached_specs, render_spec
from polyapi.execute import execute_post
from polyapi.typedefs import SpecificationDto


def update_rendered_spec(spec: SpecificationDto):
print("Updating rendered spec...")
func_str, type_defs = render_spec(spec)
data = {
"language": "python",
"signature": func_str,
"typedefs": type_defs,
}
if spec["type"] == "apiFunction":
data["apiFunctionId"] = spec["id"]
elif spec["type"] == "serverFunction":
data["customFunctionId"] = spec["id"]
else:
raise NotImplementedError("todo")

resp = execute_post("/functions/rendered-specs", data)
assert resp.status_code == 201, (resp.text, resp.status_code)
# this needs to run with something like `kn func run...`


def save_rendered_specs() -> None:
specs = read_cached_specs()
# right now we just support rendered apiFunctions
api_specs = [spec for spec in specs if spec["type"] == "apiFunction"]
for spec in api_specs:
assert spec["function"]
print("adding", spec["context"], spec["name"])
update_rendered_spec(spec)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"]

[project]
name = "polyapi-python"
version = "0.2.5.dev1"
version = "0.2.5.dev2"
description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers"
authors = [{ name = "Dan Fellin", email = "[email protected]" }]
dependencies = [
Expand Down