Events
Events are data payloads that are passed to your processes when your Lair’s triggers are invoked. For example, when making a request to a Lair configured with a http trigger, your event would contain any query parameters or json data that is included in the request.

Accessing events within your Lair

Events can be accessed using WayScript X’s context package. Simply import the package and call get_event() to output your event data (see SDK for more details). The event will be returned as a json dictionary object.
Import context package and get event
1
# my-file-a.py
2
3
import wayscript.context as context
4
event_data = context.get_event()
Copied!

Using test events

Your event payload can be replaced by sample event data during manual invocation of your triggers so you can test processes without using dummy requests or switching between services.

Creating test event json file

You can pass any valid json file to your trigger to use as a test event. Here is a sample test event json file to use with a http trigger.
1
# http_test.json
2
3
{
4
"raw_data": "",
5
"request": {
6
"query_params": {},
7
"json_data": {},
8
"metadata": {
9
"accept_encodings": "",
10
"accept_languages": "",
11
"accept_mimetypes": "",
12
"base_url": "",
13
"content_length": 0,
14
"content_type": "",
15
"content_md5": "",
16
"data": "",
17
"date": "2021-09-09T16:21:39.084628+00:00",
18
"form": "{}",
19
"full_path": "",
20
"host": "",
21
"host_url": "",
22
"if_modified_since": "2021-09-09T16:21:39.084651+00:00",
23
"if_unmodified_since": "2021-09-09T16:21:39.084657+00:00",
24
"is_json": false,
25
"is_secure": false,
26
"json": "{}",
27
"mimetype": "",
28
"mimetype_params": "{}",
29
"method": "",
30
"path": "",
31
"query_string": "",
32
"remote_addr": "",
33
"remote_user": "",
34
"referrer": "",
35
"scheme": "",
36
"url": "",
37
"url_root": "",
38
"user_agent": ""
39
}
40
}
41
}
Copied!

Attaching test events to triggers

Select your json file in the trigger configuration to use the test event. You must “Push” your file system to pass the configuration to your Lair’s remote instance.

Passing test event data to your processes

Test events are only passed to your process on manual invocations of your Lair’s triggers. Please see Triggers for more details.
Last modified 1mo ago