1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "requirements": [
10 {
11 "name": "result.json",
12 "kind": "json",
13 "maxBytes": 10000,
14 "jsonSchema": {
15 "type": "object",
16 "required": [
17 "ok",
18 "count",
19 ],
20 "properties": {
21 "ok": { "type": "boolean" },
22 "count": {
23 "type": "integer",
24 "minimum": 0,
25 },
26 },
27 "additionalProperties": False,
28 },
29 },
30 {
31 "name": "records.csv",
32 "kind": "csv",
33 "maxBytes": 10000,
34 "csv": {
35 "headers": [
36 "id",
37 "name",
38 ],
39 "minRows": 2,
40 "maxRows": 2,
41 },
42 },
43 {
44 "name": "test-report.md",
45 "kind": "text",
46 "maxBytes": 10000,
47 },
48 ],
49 "files": [
50 {
51 "name": "result.json",
52 "content": "{\"ok\":true,\"count\":2}",
53 },
54 {
55 "name": "records.csv",
56 "content": """id,name
571,Alice
582,Bob
59""",
60 },
61 {
62 "name": "test-report.md",
63 "content": """# Test record
64Two synthetic records checked.
65""",
66 },
67 ],
68}
69
70
71run = client.actor("grayt/delivery-check").call(run_input=run_input)
72
73
74print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
75for item in client.dataset(run.default_dataset_id).iterate_items():
76 print(item)
77
78