polyapi-python 0.3.7.dev4__tar.gz → 0.3.7.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.
Files changed (46) hide show
  1. {polyapi_python-0.3.7.dev4/polyapi_python.egg-info → polyapi_python-0.3.7.dev6}/PKG-INFO +1 -1
  2. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/__init__.py +11 -2
  3. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/schema.py +5 -1
  4. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/utils.py +8 -1
  5. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/webhook.py +1 -0
  6. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6/polyapi_python.egg-info}/PKG-INFO +1 -1
  7. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/pyproject.toml +1 -1
  8. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/LICENSE +0 -0
  9. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/README.md +0 -0
  10. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/__main__.py +0 -0
  11. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/api.py +0 -0
  12. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/auth.py +0 -0
  13. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/cli.py +0 -0
  14. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/client.py +0 -0
  15. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/config.py +0 -0
  16. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/constants.py +0 -0
  17. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/deployables.py +0 -0
  18. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/error_handler.py +0 -0
  19. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/exceptions.py +0 -0
  20. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/execute.py +0 -0
  21. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/function_cli.py +0 -0
  22. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/generate.py +0 -0
  23. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/parser.py +0 -0
  24. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/poly_schemas.py +0 -0
  25. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/prepare.py +0 -0
  26. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/py.typed +0 -0
  27. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/rendered_spec.py +0 -0
  28. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/server.py +0 -0
  29. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/sync.py +0 -0
  30. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/typedefs.py +0 -0
  31. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi/variables.py +0 -0
  32. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi_python.egg-info/SOURCES.txt +0 -0
  33. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi_python.egg-info/dependency_links.txt +0 -0
  34. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi_python.egg-info/requires.txt +0 -0
  35. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/polyapi_python.egg-info/top_level.txt +0 -0
  36. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/setup.cfg +0 -0
  37. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/tests/test_api.py +0 -0
  38. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/tests/test_auth.py +0 -0
  39. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/tests/test_deployables.py +0 -0
  40. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/tests/test_generate.py +0 -0
  41. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/tests/test_parser.py +0 -0
  42. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/tests/test_rendered_spec.py +0 -0
  43. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/tests/test_schema.py +0 -0
  44. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/tests/test_server.py +0 -0
  45. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/tests/test_utils.py +0 -0
  46. {polyapi_python-0.3.7.dev4 → polyapi_python-0.3.7.dev6}/tests/test_variables.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyapi-python
3
- Version: 0.3.7.dev4
3
+ Version: 0.3.7.dev6
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
@@ -1,7 +1,8 @@
1
1
  import os
2
2
  import sys
3
+ import copy
3
4
  import truststore
4
- from typing import Any, Optional, overload, Literal
5
+ from typing import Any, Dict, Optional, overload, Literal
5
6
  from typing_extensions import TypedDict
6
7
  truststore.inject_into_ssl()
7
8
  from .cli import CLI_COMMANDS
@@ -22,6 +23,7 @@ class PolyCustomDict(TypedDict, total=False):
22
23
  executionApiKey: Optional[str]
23
24
  responseStatusCode: int
24
25
  responseContentType: Optional[str]
26
+ responseHeaders: Dict[str, str]
25
27
 
26
28
 
27
29
  class _PolyCustom:
@@ -31,6 +33,7 @@ class _PolyCustom:
31
33
  "executionApiKey": None,
32
34
  "responseStatusCode": 200,
33
35
  "responseContentType": None,
36
+ "responseHeaders": {},
34
37
  }
35
38
  self._execution_id_locked = False
36
39
 
@@ -63,6 +66,9 @@ class _PolyCustom:
63
66
 
64
67
  @overload
65
68
  def __getitem__(self, key: Literal["responseContentType"]) -> Optional[str]: ...
69
+
70
+ @overload
71
+ def __getitem__(self, key: Literal["responseHeaders"]) -> Dict[str, str]: ...
66
72
 
67
73
  def __getitem__(self, key: str) -> Any:
68
74
  return self.get(key)
@@ -75,6 +81,9 @@ class _PolyCustom:
75
81
 
76
82
  @overload
77
83
  def __setitem__(self, key: Literal["responseContentType"], value: Optional[str]) -> None: ...
84
+
85
+ @overload
86
+ def __setitem__(self, key: Literal["responseHeaders"], value: Dict[str, str]) -> None: ...
78
87
 
79
88
  def __setitem__(self, key: str, value: Any) -> None:
80
89
  self.set_once(key, value)
@@ -84,7 +93,7 @@ class _PolyCustom:
84
93
 
85
94
  def copy(self) -> '_PolyCustom':
86
95
  new = _PolyCustom()
87
- new._internal_store = self._internal_store.copy()
96
+ new._internal_store = copy.deepcopy(self._internal_store)
88
97
  new._execution_id_locked = self._execution_id_locked
89
98
  return new
90
99
 
@@ -126,4 +126,8 @@ def clean_title(title: str) -> str:
126
126
 
127
127
  def map_primitive_types(type_: str) -> str:
128
128
  # Define your mapping logic here
129
- return JSONSCHEMA_TO_PYTHON_TYPE_MAP.get(type_, "Any")
129
+ return JSONSCHEMA_TO_PYTHON_TYPE_MAP.get(type_, "Any")
130
+
131
+
132
+ def is_primitive(type_: str) -> bool:
133
+ return type_ in JSONSCHEMA_TO_PYTHON_TYPE_MAP
@@ -11,6 +11,7 @@ from polyapi.schema import (
11
11
  wrapped_generate_schema_types,
12
12
  clean_title,
13
13
  map_primitive_types,
14
+ is_primitive
14
15
  )
15
16
 
16
17
 
@@ -140,11 +141,17 @@ def get_type_and_def(
140
141
  # TODO fix me
141
142
  # we don't use ReturnType as name for the list type here, we use _ReturnTypeItem
142
143
  return "List", ""
144
+ elif title and title == "ReturnType" and schema.get("type"):
145
+ assert isinstance(title, str)
146
+ schema_type = schema.get("type", "Any")
147
+ root_type, generated_code = wrapped_generate_schema_types(schema, schema_type, "Dict") # type: ignore
148
+ return (map_primitive_types(root_type), "") if is_primitive(root_type) else (root_type, generated_code) # type: ignore
143
149
  elif title:
144
150
  assert isinstance(title, str)
145
151
  # For no-types mode, avoid complex schema generation
146
152
  try:
147
- return wrapped_generate_schema_types(schema, title, "Dict") # type: ignore
153
+ root_type, generated_code = wrapped_generate_schema_types(schema, title, "Dict") # type: ignore
154
+ return ("Any", "") if root_type == "ReturnType" else wrapped_generate_schema_types(schema, title, "Dict") # type: ignore
148
155
  except:
149
156
  return "Dict", ""
150
157
  elif schema.get("allOf") and len(schema["allOf"]):
@@ -65,6 +65,7 @@ async def {function_name}(
65
65
  "data": resp,
66
66
  "statusCode": polyCustom.get("responseStatusCode", 200),
67
67
  "contentType": polyCustom.get("responseContentType", None),
68
+ "headers": polyCustom.get("responseHeaders", {{}}),
68
69
  }},
69
70
  }}, namespace="/events")
70
71
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyapi-python
3
- Version: 0.3.7.dev4
3
+ Version: 0.3.7.dev6
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
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"]
3
3
 
4
4
  [project]
5
5
  name = "polyapi-python"
6
- version = "0.3.7.dev4"
6
+ version = "0.3.7.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 = [