1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "mode": "infer",
10 "data": {
11 "name": "Example",
12 "age": 30,
13 "email": "user@example.com",
14 },
15 "schema": {
16 "$schema": "http://json-schema.org/draft-07/schema#",
17 "type": "object",
18 "properties": {
19 "name": { "type": "string" },
20 "age": {
21 "type": "integer",
22 "minimum": 0,
23 },
24 "email": {
25 "type": "string",
26 "format": "email",
27 },
28 },
29 "required": [
30 "name",
31 "email",
32 ],
33 },
34 "items": [
35 { "data": {
36 "name": "Alice",
37 "email": "alice@example.com",
38 } },
39 { "data": {
40 "name": "Bob",
41 "email": "invalid",
42 } },
43 ],
44 "draft": "draft-07",
45}
46
47
48run = client.actor("perryay/json-schema-validator-generator").call(run_input=run_input)
49
50
51print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
52for item in client.dataset(run["defaultDatasetId"]).iterate_items():
53 print(item)
54
55