polyapi-python 0.2.0.dev0__tar.gz → 0.2.0.dev1__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 (34) hide show
  1. {polyapi-python-0.2.0.dev0/polyapi_python.egg-info → polyapi-python-0.2.0.dev1}/PKG-INFO +1 -1
  2. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/utils.py +1 -1
  3. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/webhook.py +17 -3
  4. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1/polyapi_python.egg-info}/PKG-INFO +1 -1
  5. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/pyproject.toml +1 -1
  6. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/LICENSE +0 -0
  7. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/README.md +0 -0
  8. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/__init__.py +0 -0
  9. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/__main__.py +0 -0
  10. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/api.py +0 -0
  11. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/auth.py +0 -0
  12. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/cli.py +0 -0
  13. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/config.py +0 -0
  14. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/constants.py +0 -0
  15. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/exceptions.py +0 -0
  16. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/execute.py +0 -0
  17. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/function_cli.py +0 -0
  18. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/generate.py +0 -0
  19. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/py.typed +0 -0
  20. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/schema.py +0 -0
  21. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/server.py +0 -0
  22. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/typedefs.py +0 -0
  23. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi/variables.py +0 -0
  24. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi_python.egg-info/SOURCES.txt +0 -0
  25. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi_python.egg-info/dependency_links.txt +0 -0
  26. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi_python.egg-info/requires.txt +0 -0
  27. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/polyapi_python.egg-info/top_level.txt +0 -0
  28. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/setup.cfg +0 -0
  29. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/tests/test_api.py +0 -0
  30. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/tests/test_auth.py +0 -0
  31. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/tests/test_function_cli.py +0 -0
  32. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/tests/test_server.py +0 -0
  33. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/tests/test_utils.py +0 -0
  34. {polyapi-python-0.2.0.dev0 → polyapi-python-0.2.0.dev1}/tests/test_variables.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: polyapi-python
3
- Version: 0.2.0.dev0
3
+ Version: 0.2.0.dev1
4
4
  Summary: The PolyAPI Python Client
5
5
  Author-email: Dan Fellin <dan@polyapi.io>
6
6
  License: MIT License
@@ -9,7 +9,7 @@ from polyapi.schema import generate_schema_types, clean_title, map_primitive_typ
9
9
 
10
10
  # this string should be in every __init__ file.
11
11
  # it contains all the imports needed for the function or variable code to run
12
- CODE_IMPORTS = "from typing import List, Dict, Any, TypedDict, Optional\nimport requests\nimport socketio\nfrom polyapi.config import get_api_key_and_url\nfrom polyapi.execute import execute, execute_post, variable_get, variable_update\n\n"
12
+ CODE_IMPORTS = "from typing import List, Dict, Any, TypedDict, Optional\nimport requests\nimport socketio # type: ignore\nfrom polyapi.config import get_api_key_and_url\nfrom polyapi.execute import execute, execute_post, variable_get, variable_update\n\n"
13
13
 
14
14
 
15
15
  def init_the_init(full_path: str) -> None:
@@ -21,15 +21,29 @@ async def {function_name}(callback, options=None):
21
21
  else:
22
22
  print("Could not set register webhook event handler for {function_id}")
23
23
 
24
- def handleEvent(data):
24
+ async def handleEvent(data):
25
+ nonlocal api_key
25
26
  nonlocal options
26
27
  polyCustom = {{}}
27
- callback(data.get("body"), data.get("headers"), data.get("params"), polyCustom)
28
+ resp = await callback(data.get("body"), data.get("headers"), data.get("params"), polyCustom)
29
+ if resp and options.get("waitForResponse"):
30
+ await socket.emit('setWebhookListenerResponse', {{
31
+ "webhookHandleID": function_id,
32
+ "apiKey": api_key,
33
+ "clientID": eventsClientId,
34
+ "executionId": data.get("executionId"),
35
+ "response": {{
36
+ "data": resp,
37
+ "statusCode": polyCustom.get("responseStatusCode", 200),
38
+ "contentType": polyCustom.get("responseContentType", None),
39
+ }},
40
+ }}, namespace="/events")
28
41
 
29
42
  data = {{
30
43
  "clientID": eventsClientId,
31
44
  "webhookHandleID": function_id,
32
- "apiKey": api_key
45
+ "apiKey": api_key,
46
+ "waitForResponse": options.get("waitForResponse"),
33
47
  }}
34
48
  await socket.emit('registerWebhookEventHandler', data, namespace="/events", callback=registerCallback)
35
49
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: polyapi-python
3
- Version: 0.2.0.dev0
3
+ Version: 0.2.0.dev1
4
4
  Summary: The PolyAPI Python Client
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.2.0.dev0"
6
+ version = "0.2.0.dev1"
7
7
  description = "The PolyAPI Python Client"
8
8
  authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }]
9
9
  dependencies = ["requests", "typing_extensions", "jsonschema-gentypes", "pydantic>=2.5.3", "stdlib_list", "colorama", "python-socketio[asyncio_client]", "truststore"]