polyapi-python 0.2.0.dev0__py3-none-any.whl → 0.2.0.dev1__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/utils.py +1 -1
- polyapi/webhook.py +17 -3
- {polyapi_python-0.2.0.dev0.dist-info → polyapi_python-0.2.0.dev1.dist-info}/METADATA +1 -1
- {polyapi_python-0.2.0.dev0.dist-info → polyapi_python-0.2.0.dev1.dist-info}/RECORD +7 -7
- {polyapi_python-0.2.0.dev0.dist-info → polyapi_python-0.2.0.dev1.dist-info}/LICENSE +0 -0
- {polyapi_python-0.2.0.dev0.dist-info → polyapi_python-0.2.0.dev1.dist-info}/WHEEL +0 -0
- {polyapi_python-0.2.0.dev0.dist-info → polyapi_python-0.2.0.dev1.dist-info}/top_level.txt +0 -0
polyapi/utils.py
CHANGED
|
@@ -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:
|
polyapi/webhook.py
CHANGED
|
@@ -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
|
|
|
@@ -13,11 +13,11 @@ polyapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
13
13
|
polyapi/schema.py,sha256=1a7nIO867Xy3bagmPUNdYMxtS5OoCAv8oKIbYgj55dk,2957
|
|
14
14
|
polyapi/server.py,sha256=kmo5DW3HOZ606g_0ks7IB393c5EdupxWUrkX7g_GVjQ,2168
|
|
15
15
|
polyapi/typedefs.py,sha256=RZ3I6sgJm_5MuuORG1QjUE-UJy_z2WRXNdiWjEdLvQg,1371
|
|
16
|
-
polyapi/utils.py,sha256=
|
|
16
|
+
polyapi/utils.py,sha256=wZQrwSOst5wyoYYLoMk1DnAEbVsJ0-2YkmmDQ9gI3FY,5399
|
|
17
17
|
polyapi/variables.py,sha256=uYeeVcYu-OKtS8b6hlm7HlrYujcJtv3J2ByILoJrjzQ,3044
|
|
18
|
-
polyapi/webhook.py,sha256
|
|
19
|
-
polyapi_python-0.2.0.
|
|
20
|
-
polyapi_python-0.2.0.
|
|
21
|
-
polyapi_python-0.2.0.
|
|
22
|
-
polyapi_python-0.2.0.
|
|
23
|
-
polyapi_python-0.2.0.
|
|
18
|
+
polyapi/webhook.py,sha256=-Ql7RSY1Zz5m04BBZn1YNz1mFpjcVH267RTfVtbItmI,2647
|
|
19
|
+
polyapi_python-0.2.0.dev1.dist-info/LICENSE,sha256=Hi0kDr56Dsy0uYIwNt4r9G7tI8x8miXRTlyvbeplCP8,1068
|
|
20
|
+
polyapi_python-0.2.0.dev1.dist-info/METADATA,sha256=eadfCXKowGXrKT8mG9ve2-VEgz0VdJX3mHCrbVfUG4w,4763
|
|
21
|
+
polyapi_python-0.2.0.dev1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
22
|
+
polyapi_python-0.2.0.dev1.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
|
|
23
|
+
polyapi_python-0.2.0.dev1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|