1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "before": {
10 "format": "csv",
11 "data": """sku,price,stock
12A,19.9900,10
13B,25.00,4
14C,9.50,0
15D,12.00,2
16""",
17 },
18 "after": {
19 "format": "json",
20 "data": [
21 {
22 "sku": "A",
23 "price": 19.99,
24 "stock": 10,
25 },
26 {
27 "sku": "B",
28 "price": 29,
29 "stock": 4,
30 },
31 {
32 "sku": "C",
33 "price": 9.5,
34 "stock": 0,
35 },
36 {
37 "sku": "E",
38 "price": 15,
39 "stock": 5,
40 },
41 ],
42 },
43 "keyFields": ["sku"],
44 "fieldRules": {
45 "price": { "type": "decimal" },
46 "stock": { "type": "decimal" },
47 },
48 "snapshotsComplete": True,
49}
50
51
52run = client.actor("mrtronson/typed-csv-json-diff").call(run_input=run_input)
53
54
55print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
56for item in client.dataset(run.default_dataset_id).iterate_items():
57 print(item)
58
59