You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 5, 2025. It is now read-only.
1. Tests if the event.name property has a value, if not sets it to placeholder.
31
+
2. Logs the value of a CloudEvents extension attribute called "foo". To pass an extension attribute called foo in a request using curl, use -H "ce-foo: bar".
Copy file name to clipboardExpand all lines: docs/transformation/functions/pythonfunctions.md
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,14 +27,18 @@ spec:
27
27
runtime: python
28
28
adapterOverrides:
29
29
public: true
30
-
entrypoint: endpoint
30
+
entrypoint: handler
31
31
code: |
32
32
import json
33
-
def endpoint(event, context):
33
+
def handler(event, context):
34
34
jsonEvent = json.loads(event)
35
-
return "Hello " + jsonEvent['name']
35
+
print(context.client_context.custom["foo"]) # (1)
36
+
return "Hello " + jsonEvent['name'] # (2)
36
37
```
37
38
39
+
1. Logs the value of a CloudEvents extension attribute called "foo". To pass an extension attribute called foo in a request using curl, use -H "ce-foo: bar".
40
+
2. Returns "Hello" followed by the value of the name attribute in the event message
1. Logs the value of a CloudEvents extension attribute called "foo". To pass an extension attribute called foo in a request using curl, use -H "ce-foo: bar".
0 commit comments